Commit graph

42 commits

Author SHA1 Message Date
f840069ecb
update copyright dates 2026-02-11 13:02:12 +00:00
4573e170ed
test suite: use match statement where practicable (21 files) 2025-09-23 09:20:53 +00:00
17ae5a49c3
test/objattrtest_d: remove prefixes on test files 2025-03-29 09:30:15 +00:00
e54f039690
update copyright dates 2025-02-16 14:42:27 +00:00
926716090a
test suite: rename some directories
- cmdtest_py_d -> cmdtest_d
- objtest_py_d -> objtest_d
- objattrtest_py_d -> objattrtest_d
2024-10-18 10:32:15 +00:00
74bc49f973
whitespace: tests, top level 2024-10-18 10:32:12 +00:00
5150ca586b
update file header 2024-10-18 10:32:06 +00:00
66521a07f2
update --longhelp text 2024-10-08 12:55:58 +00:00
8e46932475
update copyright dates 2024-01-19 11:05:10 +00:00
a7e816f98e
test suite: make test scripts importable as modules 2023-10-13 09:51:14 +00:00
6a21044127
test suite: improve initialization of sys.path and repo_root 2023-10-13 09:51:14 +00:00
2076c0308b
pylint (test suite) - various cleanups 2023-10-11 12:58:53 +00:00
033822f565
pylint (test suite) - use "is" for bool,None,type equality 2023-10-11 12:58:52 +00:00
7b32c412d5
pylint (test suite) - imports 2023-10-11 12:58:51 +00:00
01430166e5
whitespace, comments, docstrings (test suite) 2023-10-11 12:58:51 +00:00
18d0b285ee
objattrtest.py: cleanups, import cleanups 2023-10-03 14:27:55 +00:00
31a6e62a24
test suite: sys.path, overlay, PYTHONPATH cleanups 2023-09-26 10:23:40 +00:00
0cc96af152
test suite: PYTHONPATH and other env var fixes 2023-09-25 13:25:00 +00:00
9e1935ad19
opts.init() -> Config() 2023-04-04 16:04:10 +00:00
c7adb56e38
Config API, Part I
This patch eliminates the global configuration variables `opt` and `g`, making
all functions and class instances locally configurable.  Configuration data is
passed to functions and constructors via the `cfg` parameter and made available
to methods in `self.cfg`.

Local configuration free from dependence on the command line will enable the
creation of multiple, independently configured instances of MMGen’s data
objects within a single process.

Potential applications include testing (tracking wallets configured to interact
with spawned processes, for example) and the use of MMGen as a library for
other projects.

This patch completes most of the work required to enable the API.  The full
implementation will appear in a forthcoming commit.
2023-03-28 18:14:37 +00:00
1aeefd64ae
update copyright dates 2023-01-03 10:36:07 +00:00
20f4b12832
module docstring cleanups [134 files] 2022-11-14 09:54:07 +00:00
076cec7495
base_proto.bitcoin -> proto.btc, ... [code] 2022-10-03 10:00:00 +00:00
0fef35f567
move tracking wallet modules to tw and base_proto/{name}/tw 2022-02-10 12:51:41 +00:00
1fb022d151
finish modularization of tracking wallet classes
- protocol-independent base classes remain in `tw*.py`
- protocol-dependent subclasses are in `base_proto/{name}/tw*.py`
2022-02-06 13:28:45 +00:00
aad252a077
handle MMGen exceptions via die()
- exception module is imported only after an error occurs
2022-02-05 13:32:56 +00:00
41376eb515
new MMGenSystemExit exception; remove rdie(), ydie() 2022-02-05 13:32:56 +00:00
818488c559
modularize transaction classes
The monolithic tx.py module has been split into multiple modules, and a
clean separation of protocol-dependent and protocol-independent code has
been carried out.

- Protocol-independent base classes are located under `tx`.
- Protocol-dependent subclasses are under `base_proto/{name}/tx`.
- The code in `tx/__init__.py` loads the required module and returns an
  initialized instance of the requested class.
2022-02-03 20:41:28 +00:00
59bffb59b2
CoinProtocol.Base: skip loading of .amt module via 'need_amt=False' 2022-01-29 11:25:03 +00:00
ad569cbeb7
import cleanups throughout 2022-01-22 14:26:13 +00:00
e0352568db
addr.py: move AddrList and related classes to addrlist.py
- also move PasswordList to passwdlist.py
- add a minimal unit test

Testing:

    $ test/unit_tests.py addrlist
2022-01-15 14:00:08 +00:00
1a896d9af9
update copyright dates 2022-01-04 19:51:22 +00:00
6692a43d59
f-strings, whitespace (test files) [44 files patched] 2021-09-29 21:17:57 +00:00
cb7f38370b
Update copyright dates 2021-02-19 20:09:06 +03:00
c3f185e8b0
eliminate use of global vars g.proto, g.coin, g.rpc and others
This patch eliminates nearly all the global variables that changed during the
execution of scripts.  With a few minor exceptions, global vars are now used
only during initialization or reserved for cfg file / cmdline options and other
unchanging values.

The result is a code base that's much more maintainable and extensible and less
error-prone.  The autosigning code, which supports signing of transactions for
multiple protocols and networks, has been greatly simplified.

Doing away with globals required many changes throughout the code base, and
other related (and not so related) changes and cleanups were made along the
way, resulting in an enormous patch.

Additional code changes include:

    - tx.py: complete reorganization of TX classes and use of nesting

    - protocol.py: separation of Regtest and Testnet into distinct subclasses
      with separate address and transaction files and file extensions

    - new module help.py for the help notes, loaded on demand

    - addr.py: rewrite of the address file label parsing code

    - tx.py,tw.py: use of generators to create formatted text

User-visible changes include:

    - importing of addresses for tokens not yet in the user's tracking wallet
      is now performed with the `--token-addr` option instead of `--token`

Testing:

    Testing this patch requires a full run of the test suite as described on the
    Test-Suite wiki page.
2020-05-28 09:53:34 +00:00
43432327c7
global change: init_coin() -> g.proto = init_proto() 2020-05-16 12:44:43 +00:00
31f7236731
protocol.py: new coin protocol instance attrs
- add 'testnet', 'regtest' and 'dcoin' attributes to coin protocol instance,
  remove is_testnet() method

- g.testnet -> g.proto.testnet, g.regtest -> g.proto.regtest

- g.coin and g.dcoin are now read-only properties shadowing g.proto.coin
  and g.proto.dcoin, respectively
2020-05-16 09:27:13 +00:00
f297645796
ImmutableAttr,ListItemAttr: renamed, call signature simplified 2020-04-08 14:13:13 +00:00
673b97b3b8
update copyright dates 2020-02-18 14:07:27 +00:00
4d23f122aa
add g.network convenience variable 2019-11-04 16:47:21 +00:00
174caeebd3
MMGenImmutableAttr: allow callable dtype arg, remove 'no_type_check' option 2019-10-19 20:27:24 +03:00
3224b9c7d2
new test: objattrtest.py: test objects' immutable attributes 2019-10-19 18:22:31 +03:00