Skip to content

Commit

Permalink
lint: PEP8 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed Feb 3, 2020
1 parent 75684d3 commit 85205cf
Showing 1 changed file with 31 additions and 24 deletions.
55 changes: 31 additions & 24 deletions eth_account/hdaccount/deterministic.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,28 @@
Skips serialization and public key derivation as unnecssary for this library's purposes.
Notes:
- Integers are modulo the order of the curve (referred to as n).
- Addition (+) of two coordinate pair is defined as application of the EC group operation.
- Concatenation (||) is the operation of appending one byte sequence onto another.
Definitions:
- point(p): returns the coordinate pair resulting from EC point multiplication
(repeated application of the EC group operation) of the secp256k1 base point
with the integer p.
- ser_32(i): serialize a 32-bit unsigned integer i as a 4-byte sequence,
most significant byte first.
- ser_256(p): serializes the integer p as a 32-byte sequence, most significant byte first.
- ser_P(P): serializes the coordinate pair P = (x,y) as a byte sequence using SEC1's compressed
form: (0x02 or 0x03) || ser_256(x), where the header byte depends on the parity of the
omitted y coordinate.
- parse_256(p): interprets a 32-byte sequence as a 256-bit number, most significant byte first.
Notes
-----
* Integers are modulo the order of the curve (referred to as n).
* Addition (+) of two coordinate pair is defined as application of the EC group operation.
* Concatenation (||) is the operation of appending one byte sequence onto another.
Definitions
-----------
* point(p): returns the coordinate pair resulting from EC point multiplication
(repeated application of the EC group operation) of the secp256k1 base point
with the integer p.
* ser_32(i): serialize a 32-bit unsigned integer i as a 4-byte sequence,
most significant byte first.
* ser_256(p): serializes the integer p as a 32-byte sequence, most significant byte first.
* ser_P(P): serializes the coordinate pair P = (x,y) as a byte sequence using SEC1's compressed
form: (0x02 or 0x03) || ser_256(x), where the header byte depends on the parity of the
omitted y coordinate.
* parse_256(p): interprets a 32-byte sequence as a 256-bit number, most significant byte first.
"""
# Additional notes:
# - This algorithm only implements private parent key → private child key CKD function,
Expand All @@ -33,19 +39,20 @@
# not intended to be ultimately used for Bitcoin key derivations. This presents a simplified API.
import hashlib
import hmac
from eth_utils import (
to_int,
)
from hexbytes import (
HexBytes,
)
from typing import (
Tuple,
Union,
)

from eth_keys import (
keys,
)
from eth_utils import (
to_int,
)
from hexbytes import (
HexBytes,
)

SECP256K1_N = int("FFFFFFFF_FFFFFFFF_FFFFFFFF_FFFFFFFE_BAAEDCE6_AF48A03B_BFD25E8C_D0364141", 16)

Expand Down Expand Up @@ -170,7 +177,7 @@ def derive_child_key(

class HDPath:
def __init__(self, path: str):
'''
"""
Constructor for this class. Initializes an hd account generator and
if possible the encoded key and the derivation path. If no arguments are
specified, create a new account with createAccount(...) or initialize
Expand All @@ -180,7 +187,7 @@ def __init__(self, path: str):
where idx_* is either an integer value (soft node)
or an integer value followed by either the "'" char
or the "H" char (hardened node)
'''
"""
nodes = path.split('/')
if not nodes[0] == 'm':
raise ValueError(f'Path is not valid: "{path}". Must start with "m"')
Expand Down

0 comments on commit 85205cf

Please sign in to comment.