Skip to content
Snippets Groups Projects
Commit c07a2155 authored by Moul's avatar Moul
Browse files

[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
parent b69f1cd2
No related branches found
No related tags found
1 merge request!201#365: Bump copyright to 2022, Bump pre-commit hooks and apply them
repos: repos:
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 21.6b0 rev: 22.1.0
hooks: hooks:
- id: black - id: black
- repo: https://github.com/PyCQA/isort - repo: https://github.com/PyCQA/isort
rev: 5.9.2 rev: 5.10.1
hooks: hooks:
- id: isort - id: isort
args: ["--profile", "black"] args: ["--profile", "black"]
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v2.21.0 rev: v2.31.0
hooks: hooks:
- id: pyupgrade - id: pyupgrade
args: [--py37-plus] args: [--py37-plus]
...@@ -21,7 +21,7 @@ repos: ...@@ -21,7 +21,7 @@ repos:
- "--server" - "--server"
- "https://git.duniter.org" - "https://git.duniter.org"
- repo: https://github.com/Lucas-C/pre-commit-hooks - repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.10 rev: v1.1.12
hooks: hooks:
- id: insert-license - id: insert-license
files: \.py$ files: \.py$
......
...@@ -207,4 +207,4 @@ def amount_in_current_base(source): ...@@ -207,4 +207,4 @@ def amount_in_current_base(source):
""" """
Get amount in current base from input or output source Get amount in current base from input or output source
""" """
return source.amount * 10 ** source.base return source.amount * 10**source.base
...@@ -436,8 +436,8 @@ def generate_transaction_document( ...@@ -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 it's not a foreign exchange transaction, we remove units after 2 digits after the decimal point.
if issuers not in outputAddresses: if issuers not in outputAddresses:
total_tx_amount = ( total_tx_amount = (
total_tx_amount // 10 ** curentUnitBase total_tx_amount // 10**curentUnitBase
) * 10 ** curentUnitBase ) * 10**curentUnitBase
# Generate output # Generate output
################ ################
......
...@@ -204,13 +204,10 @@ def test_compute_amounts(): ...@@ -204,13 +204,10 @@ def test_compute_amounts():
assert tx.compute_amounts([1.001], mock_ud_value) == [314] assert tx.compute_amounts([1.001], mock_ud_value) == [314]
assert tx.compute_amounts([1.009], mock_ud_value) == [317] 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. # This case will not happen in real use, but this particular function will allow it.
assert ( assert tx.compute_amounts(
tx.compute_amounts( [0.0099],
[0.0099], 100,
100, ) == [1]
)
== [1]
)
# generate_transaction_document() # generate_transaction_document()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment