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:
- 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$
......
......@@ -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
......@@ -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
################
......
......@@ -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()
......
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