From c07a21552c3a1a58578d436c81b9985714c8fecd Mon Sep 17 00:00:00 2001 From: Moul <moul@moul.re> Date: Tue, 15 Feb 2022 18:46:15 +0100 Subject: [PATCH] [enh] Bump pre-commit hooks and apply them Specially for insert-license which fixes a bug: https://github.com/Lucas-C/pre-commit-hooks/issues/25 Black is finally released as stable and changes small part of the code --- .pre-commit-config.yaml | 8 ++++---- silkaj/money.py | 2 +- silkaj/tx.py | 4 ++-- tests/test_unit_tx.py | 11 ++++------- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2c5f2027..ea6980e8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,15 +1,15 @@ repos: - repo: https://github.com/psf/black - rev: 21.6b0 + rev: 22.1.0 hooks: - id: black - repo: https://github.com/PyCQA/isort - rev: 5.9.2 + rev: 5.10.1 hooks: - id: isort args: ["--profile", "black"] - repo: https://github.com/asottile/pyupgrade - rev: v2.21.0 + rev: v2.31.0 hooks: - id: pyupgrade args: [--py37-plus] @@ -21,7 +21,7 @@ repos: - "--server" - "https://git.duniter.org" - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.1.10 + rev: v1.1.12 hooks: - id: insert-license files: \.py$ diff --git a/silkaj/money.py b/silkaj/money.py index d030a661..3865db8e 100644 --- a/silkaj/money.py +++ b/silkaj/money.py @@ -207,4 +207,4 @@ def amount_in_current_base(source): """ Get amount in current base from input or output source """ - return source.amount * 10 ** source.base + return source.amount * 10**source.base diff --git a/silkaj/tx.py b/silkaj/tx.py index 9ee4b307..f08f4262 100644 --- a/silkaj/tx.py +++ b/silkaj/tx.py @@ -436,8 +436,8 @@ def generate_transaction_document( # if it's not a foreign exchange transaction, we remove units after 2 digits after the decimal point. if issuers not in outputAddresses: total_tx_amount = ( - total_tx_amount // 10 ** curentUnitBase - ) * 10 ** curentUnitBase + total_tx_amount // 10**curentUnitBase + ) * 10**curentUnitBase # Generate output ################ diff --git a/tests/test_unit_tx.py b/tests/test_unit_tx.py index 08509bcc..c2d21bed 100644 --- a/tests/test_unit_tx.py +++ b/tests/test_unit_tx.py @@ -204,13 +204,10 @@ def test_compute_amounts(): assert tx.compute_amounts([1.001], mock_ud_value) == [314] assert tx.compute_amounts([1.009], mock_ud_value) == [317] # This case will not happen in real use, but this particular function will allow it. - assert ( - tx.compute_amounts( - [0.0099], - 100, - ) - == [1] - ) + assert tx.compute_amounts( + [0.0099], + 100, + ) == [1] # generate_transaction_document() -- GitLab