Fix python lint
This commit is contained in:
@@ -7,11 +7,16 @@ disable = C0114, # missing-module-docstring
|
||||
C0116, # missing-function-docstring
|
||||
C0103, # invalid-name
|
||||
R0801, # duplicate-code
|
||||
R0913 # too-many-arguments
|
||||
R0903, # too-few-public-methods
|
||||
R0913, # too-many-arguments
|
||||
R0914, # too-many-locals
|
||||
W0603, # global-statement
|
||||
E0401 # import-error
|
||||
extension-pkg-whitelist=hid
|
||||
max-line-length = 130
|
||||
|
||||
[pycodestyle]
|
||||
max-line-length = 90
|
||||
max-line-length = 130
|
||||
|
||||
[mypy-hid.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
@@ -3,7 +3,7 @@ from typing import List
|
||||
from bip_utils import Bip39SeedGenerator
|
||||
from bip_utils.utils.mnemonic import Mnemonic
|
||||
|
||||
from .tree import (
|
||||
from staking_deposit.key_handling.key_derivation.tree import (
|
||||
derive_master_SK,
|
||||
derive_child_SK,
|
||||
)
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
from typing import List
|
||||
|
||||
from staking_deposit.utils.crypto import (
|
||||
HKDF,
|
||||
SHA256,
|
||||
)
|
||||
from py_ecc.optimized_bls12_381 import curve_order as bls_curve_order
|
||||
from typing import List
|
||||
|
||||
|
||||
def _flip_bits_256(input: int) -> int:
|
||||
def _flip_bits_256(value: int) -> int:
|
||||
"""
|
||||
Flips 256 bits worth of `input`.
|
||||
Flips 256 bits worth of `value`.
|
||||
"""
|
||||
return input ^ (2**256 - 1)
|
||||
return value ^ (2**256 - 1)
|
||||
|
||||
|
||||
def _IKM_to_lamport_SK(*, IKM: bytes, salt: bytes) -> List[bytes]:
|
||||
|
||||
@@ -32,12 +32,9 @@ def PBKDF2(*, password: bytes, salt: bytes, dklen: int, c: int, prf: str) -> byt
|
||||
if 'sha' not in prf:
|
||||
raise ValueError(f"String 'sha' is not in `prf`({prf})")
|
||||
if 'sha256' in prf and c < 2**18:
|
||||
'''
|
||||
Verify the number of rounds of SHA256-PBKDF2. SHA512 not checked as use in BIP39
|
||||
does not require, and therefore doesn't use, safe parameters (c=2048).
|
||||
|
||||
Ref: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#from-mnemonic-to-seed
|
||||
'''
|
||||
# Verify the number of rounds of SHA256-PBKDF2. SHA512 not checked as use in BIP39
|
||||
# does not require, and therefore doesn't use, safe parameters (c=2048).
|
||||
# Ref: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#from-mnemonic-to-seed
|
||||
raise ValueError("The PBKDF2 parameters chosen are not secure.")
|
||||
_hash = _sha256 if 'sha256' in prf else _sha512
|
||||
res = _PBKDF2(password=password, salt=salt, dkLen=dklen, count=c, hmac_hash_module=_hash) # type: ignore
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
import re
|
||||
|
||||
from ragger.backend import BackendInterface
|
||||
from ragger.utils.misc import get_current_app_name_and_version
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import pytest
|
||||
|
||||
from client.client import EthAppClient, StatusWord
|
||||
|
||||
from ragger.error import ExceptionRAPDU
|
||||
from ragger.backend import BackendInterface
|
||||
|
||||
from client.client import EthAppClient, StatusWord
|
||||
|
||||
|
||||
def test_provide_erc20_token(backend: BackendInterface):
|
||||
|
||||
|
||||
@@ -61,12 +61,13 @@ Or you can refer to the section `Available pytest options` to configure the opti
|
||||
With Ethereum App, it is also possible to load an app (like a _plugin_), and use the `app-ethereum` like a _library_.
|
||||
Such case is tested with application clone, using `ThunderCore`.
|
||||
|
||||
This special configuration needs an additional command line parameter `--with_lib_mode`, where only the dedicated tests are selected.
|
||||
This special configuration needs an additional command line parameter `--with_lib_mode`,
|
||||
where only the dedicated tests are selected.
|
||||
|
||||
## Adding a test
|
||||
|
||||
When adding new Module for tests, just be carrefull to declare it correctly in order to be handled following the parameter `--with_lib_mode`.
|
||||
please refer to `conftest.py`.
|
||||
When adding new Module for tests, just be carrefull to declare it correctly in order to be handled
|
||||
following the parameter `--with_lib_mode`. please refer to `conftest.py`.
|
||||
|
||||
## Available pytest options
|
||||
|
||||
|
||||
Reference in New Issue
Block a user