diff --git a/poetry.lock b/poetry.lock index ead9d94489f9c3495b81e3e5aa46596c1bfdac8e..e2edd9205cc868baf0053fe4610b9af50a9bb48c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -106,18 +106,24 @@ marker = "python_version >= \"3.6\" and python_version < \"4.0\"" name = "black" optional = false python-versions = ">=3.6" -version = "19.10b0" +version = "20.8b1" [package.dependencies] appdirs = "*" -attrs = ">=18.1.0" -click = ">=6.5" +click = ">=7.1.2" +mypy-extensions = ">=0.4.3" pathspec = ">=0.6,<1" -regex = "*" -toml = ">=0.9.4" +regex = ">=2020.1.8" +toml = ">=0.10.1" typed-ast = ">=1.4.0" +typing-extensions = ">=3.7.4" + +[package.dependencies.dataclasses] +python = "<3.7" +version = ">=0.6" [package.extras] +colorama = ["colorama (>=0.4.3)"] d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] [[package]] @@ -186,6 +192,15 @@ optional = false python-versions = "*" version = "1.0.1" +[[package]] +category = "dev" +description = "A backport of the dataclasses module for Python 3.6" +marker = "python_version >= \"3.6\" and python_version < \"3.7\"" +name = "dataclasses" +optional = false +python-versions = ">=3.6, <3.7" +version = "0.7" + [[package]] category = "dev" description = "Distribution utilities" @@ -346,6 +361,15 @@ optional = false python-versions = ">=3.5" version = "4.7.6" +[[package]] +category = "dev" +description = "Experimental type system extensions for programs checked with the mypy typechecker." +marker = "python_version >= \"3.6\" and python_version < \"4.0\"" +name = "mypy-extensions" +optional = false +python-versions = "*" +version = "0.4.3" + [[package]] category = "dev" description = "Node.js virtual environment builder" @@ -742,7 +766,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["pathlib2", "unittest2", "jaraco.itertools", "func-timeout"] [metadata] -content-hash = "fe9defd881ff1ab7da675e5679bf01b12f9c8fe354feea820bd13fe0e6f20958" +content-hash = "5fb062da355b9170f5dc0772c2ae50d4231081e04849305a97ac4d003b05bfde" python-versions = "^3.5.3" [metadata.files] @@ -794,8 +818,8 @@ base58 = [ {file = "base58-1.0.3.tar.gz", hash = "sha256:9a793c599979c497800eb414c852b80866f28daaed5494703fc129592cc83e60"}, ] black = [ - {file = "black-19.10b0-py36-none-any.whl", hash = "sha256:1b30e59be925fafc1ee4565e5e08abef6b03fe455102883820fe5ee2e4734e0b"}, - {file = "black-19.10b0.tar.gz", hash = "sha256:c2edb73a08e9e0e6f65a0e6af18b059b8b1cdd5bef997d7a0b181df93dc81539"}, + {file = "black-20.8b1-py3-none-any.whl", hash = "sha256:70b62ef1527c950db59062cda342ea224d772abdf6adc58b86a45421bab20a6b"}, + {file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"}, ] cffi = [ {file = "cffi-1.14.1-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:66dd45eb9530e3dde8f7c009f84568bc7cac489b93d04ac86e3111fb46e470c2"}, @@ -883,6 +907,10 @@ coverage-badge = [ {file = "coverage-badge-1.0.1.tar.gz", hash = "sha256:142fd121f3bd14956aff3c45bff6f8bc37bd74c6350626a950ebb6accb24276e"}, {file = "coverage_badge-1.0.1-py2.py3-none-any.whl", hash = "sha256:3796de21b4e190d38beb8806956946fbdb02fe3a2a7452b460a9cff958009833"}, ] +dataclasses = [ + {file = "dataclasses-0.7-py3-none-any.whl", hash = "sha256:3459118f7ede7c8bea0fe795bff7c6c2ce287d01dd226202f7c9ebc0610a7836"}, + {file = "dataclasses-0.7.tar.gz", hash = "sha256:494a6dcae3b8bcf80848eea2ef64c0cc5cd307ffc263e17cdf42f3e5420808e6"}, +] distlib = [ {file = "distlib-0.3.1-py2.py3-none-any.whl", hash = "sha256:8c09de2c67b3e7deef7184574fc060ab8a793e7adbb183d942c389c8b13c52fb"}, {file = "distlib-0.3.1.zip", hash = "sha256:edf6116872c863e1aa9d5bb7cb5e05a022c519a4594dc703843343a9ddd9bff1"}, @@ -952,6 +980,10 @@ multidict = [ {file = "multidict-4.7.6-cp38-cp38-win_amd64.whl", hash = "sha256:7388d2ef3c55a8ba80da62ecfafa06a1c097c18032a501ffd4cabbc52d7f2b19"}, {file = "multidict-4.7.6.tar.gz", hash = "sha256:fbb77a75e529021e7c4a8d4e823d88ef4d23674a202be4f5addffc72cbb91430"}, ] +mypy-extensions = [ + {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, + {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, +] nodeenv = [ {file = "nodeenv-1.4.0-py2.py3-none-any.whl", hash = "sha256:4b0b77afa3ba9b54f4b6396e60b0c83f59eaeb2d63dc3cc7a70f7f4af96c82bc"}, ] diff --git a/pyproject.toml b/pyproject.toml index 1732fea0d6aa94275f2f53654ef4a3156c45fbd4..b4d1b4090762289fdafca27684015a347abb70f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ pendulum = "^2.1.2" PyNaCl = "^1.3" [tool.poetry.dev-dependencies] -black = {version = "^19.10b0", python = "^3.6"} +black = {version = "^20.8b1", python = "^3.6"} pre-commit = "^1.18" pytest = "^6.0" pytest-cov = "^2.7" diff --git a/silkaj/tx.py b/silkaj/tx.py index 14898d105a95b8b19da60112c31a03b5dace9382..bcc5f499b9ad78acf903a84073db7afa0484a0ce 100644 --- a/silkaj/tx.py +++ b/silkaj/tx.py @@ -140,7 +140,12 @@ async def send_transaction( == "yes" ): await handle_intermediaries_transactions( - key, issuer_pubkey, tx_amounts, recipients, comment, outputbackchange, + key, + issuer_pubkey, + tx_amounts, + recipients, + comment, + outputbackchange, ) else: client = ClientInstance().client @@ -232,10 +237,18 @@ async def transaction_confirmation( tx = list() # display account situation display_amount( - tx, "pubkey's balance before tx", pubkey_amount, ud_value, currency_symbol, + tx, + "pubkey's balance before tx", + pubkey_amount, + ud_value, + currency_symbol, ) display_amount( - tx, "total transaction amount", total_tx_amount, ud_value, currency_symbol, + tx, + "total transaction amount", + total_tx_amount, + ud_value, + currency_symbol, ) display_amount( tx, @@ -280,7 +293,12 @@ async def get_list_input_for_transaction(pubkey, TXamount): async def handle_intermediaries_transactions( - key, issuers, tx_amounts, outputAddresses, Comment="", OutputbackChange=None, + key, + issuers, + tx_amounts, + outputAddresses, + Comment="", + OutputbackChange=None, ): client = ClientInstance().client while True: diff --git a/tests/test_tx.py b/tests/test_tx.py index 33d5b4d7f1c14c7546d77f057753b5a427fc1116..4c17cff5ff3a6c093d6aefb146c2ab47ed1d3387 100644 --- a/tests/test_tx.py +++ b/tests/test_tx.py @@ -41,7 +41,15 @@ async def test_transaction_amount(monkeypatch): ([141.89, 141.99], None, ["A", "B"], [14189, 14199]), # tests for --amount_UD (None, [1.1], ["A"], [round(1.1 * udvalue)]), - (None, [1.9], ["A", "B",], [round(1.9 * udvalue), round(1.9 * udvalue)]), + ( + None, + [1.9], + [ + "A", + "B", + ], + [round(1.9 * udvalue), round(1.9 * udvalue)], + ), (None, [1.0001], ["A"], [round(1.0001 * udvalue)]), (None, [9.9999], ["A"], [round(9.9999 * udvalue)]), (None, [1.9, 2.3], ["A", "B"], [round(1.9 * udvalue), round(2.3 * udvalue)]), diff --git a/tests/test_unit_tx.py b/tests/test_unit_tx.py index 2441e366acc2d0573e8ddd82699e782d01850a6a..d0b755cb870da486c27756fefb9452676073228f 100644 --- a/tests/test_unit_tx.py +++ b/tests/test_unit_tx.py @@ -218,7 +218,8 @@ def test_compute_amounts_errors(capsys): with pytest.raises(SystemExit) as pytest_exit: # read output to check error. compute_amounts( - trial[0], trial[1], + trial[0], + trial[1], ) expected_error = "Error: amount {0} is too low.".format(trial[0][0]) assert capsys.readouterr() == expected_error @@ -241,7 +242,8 @@ def test_compute_amounts(): assert compute_amounts([1.001], ud_value) == [314] assert compute_amounts([1.009], ud_value) == [317] # This case will not happen in real use, but this particular function will allow it. - assert compute_amounts([0.0099], 100,) == [1] + + assert compute_amounts([0.0099], 100) == [1] # transaction_amount() @@ -289,7 +291,9 @@ def test_compute_amounts(): ( None, [0.00002], - ["DBM6F5ChMJzpmkUdL5zD9UXKExmZGfQ1AgPDQy4MxSBw",], + [ + "DBM6F5ChMJzpmkUdL5zD9UXKExmZGfQ1AgPDQy4MxSBw", + ], "Error: amount 0.00002 is too low.", ), (