diff --git a/duniterpy/constants.py b/duniterpy/constants.py index c76c99621b0c8b9c98ac4d4d5ab329b617dc4bf5..626f338238a3340bde5678c8520540420c8894f4 100644 --- a/duniterpy/constants.py +++ b/duniterpy/constants.py @@ -8,8 +8,10 @@ BLOCK_ID_REGEX = "[0-9]+" BLOCK_UID_REGEX = "{block_id_regex}-{block_hash_regex}".format( block_id_regex=BLOCK_ID_REGEX, block_hash_regex=BLOCK_HASH_REGEX ) -CONDITIONS_REGEX = "(&&|\\|\\|| |[()]|(SIG\\({pubkey_regex}\\)|(XHX\\({hash_regex}\\))))*".format( - pubkey_regex=PUBKEY_REGEX, hash_regex=HASH_REGEX +CONDITIONS_REGEX = ( + "(&&|\\|\\|| |[()]|(SIG\\({pubkey_regex}\\)|(XHX\\({hash_regex}\\))))*".format( + pubkey_regex=PUBKEY_REGEX, hash_regex=HASH_REGEX + ) ) IPV4_REGEX = ( "(?:(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][" diff --git a/duniterpy/documents/block.py b/duniterpy/documents/block.py index 7cf69ef45cd02fd4efd5616250a83406876e7a3a..62a4e27389bb462397273c2052bd428038d4b4bd 100644 --- a/duniterpy/documents/block.py +++ b/duniterpy/documents/block.py @@ -18,46 +18,46 @@ BlockType = TypeVar("BlockType", bound="Block") class Block(Document): """ -The class Block handles Block documents. - -.. note:: A block document is specified by the following format : - - | Version: VERSION - | Type: Block - | Currency: CURRENCY - | Nonce: NONCE - | Number: BLOCK_NUMBER - | PoWMin: NUMBER_OF_ZEROS - | Time: GENERATED_ON - | MedianTime: MEDIAN_DATE - | UniversalDividend: DIVIDEND_AMOUNT - | Issuer: ISSUER_KEY - | PreviousHash: PREVIOUS_HASH - | PreviousIssuer: PREVIOUS_ISSUER_KEY - | Parameters: PARAMETERS - | MembersCount: WOT_MEM_COUNT - | Identities: - | PUBLIC_KEY:SIGNATURE:TIMESTAMP:USER_ID - | ... - | Joiners: - | PUBLIC_KEY:SIGNATURE:NUMBER:HASH:TIMESTAMP:USER_ID - | ... - | Actives: - | PUBLIC_KEY:SIGNATURE:NUMBER:HASH:TIMESTAMP:USER_ID - | ... - | Leavers: - | PUBLIC_KEY:SIGNATURE:NUMBER:HASH:TIMESTAMP:USER_ID - | ... - | Excluded: - | PUBLIC_KEY - | ... - | Certifications: - | PUBKEY_FROM:PUBKEY_TO:BLOCK_NUMBER:SIGNATURE - | ... - | Transactions: - | COMPACT_TRANSACTION - | ... - | BOTTOM_SIGNATURE + The class Block handles Block documents. + + .. note:: A block document is specified by the following format : + + | Version: VERSION + | Type: Block + | Currency: CURRENCY + | Nonce: NONCE + | Number: BLOCK_NUMBER + | PoWMin: NUMBER_OF_ZEROS + | Time: GENERATED_ON + | MedianTime: MEDIAN_DATE + | UniversalDividend: DIVIDEND_AMOUNT + | Issuer: ISSUER_KEY + | PreviousHash: PREVIOUS_HASH + | PreviousIssuer: PREVIOUS_ISSUER_KEY + | Parameters: PARAMETERS + | MembersCount: WOT_MEM_COUNT + | Identities: + | PUBLIC_KEY:SIGNATURE:TIMESTAMP:USER_ID + | ... + | Joiners: + | PUBLIC_KEY:SIGNATURE:NUMBER:HASH:TIMESTAMP:USER_ID + | ... + | Actives: + | PUBLIC_KEY:SIGNATURE:NUMBER:HASH:TIMESTAMP:USER_ID + | ... + | Leavers: + | PUBLIC_KEY:SIGNATURE:NUMBER:HASH:TIMESTAMP:USER_ID + | ... + | Excluded: + | PUBLIC_KEY + | ... + | Certifications: + | PUBKEY_FROM:PUBKEY_TO:BLOCK_NUMBER:SIGNATURE + | ... + | Transactions: + | COMPACT_TRANSACTION + | ... + | BOTTOM_SIGNATURE """ diff --git a/duniterpy/documents/membership.py b/duniterpy/documents/membership.py index ddf245b7fd42533014a19190f83d2e8adb366372..632a02216270e0057525714dabfb0ed1a6e361c4 100644 --- a/duniterpy/documents/membership.py +++ b/duniterpy/documents/membership.py @@ -16,16 +16,16 @@ MembershipType = TypeVar("MembershipType", bound="Membership") class Membership(Document): """ -.. note:: A membership document is specified by the following format : - - | Version: VERSION - | Type: Membership - | Currency: CURRENCY_NAME - | Issuer: ISSUER - | Block: NUMBER-HASH - | Membership: MEMBERSHIP_TYPE - | UserID: USER_ID - | CertTS: CERTIFICATION_TS + .. note:: A membership document is specified by the following format : + + | Version: VERSION + | Type: Membership + | Currency: CURRENCY_NAME + | Issuer: ISSUER + | Block: NUMBER-HASH + | Membership: MEMBERSHIP_TYPE + | UserID: USER_ID + | CertTS: CERTIFICATION_TS """ diff --git a/duniterpy/documents/peer.py b/duniterpy/documents/peer.py index bc26cdbc0ed5dcea2a1a65cca1b1c948bf502e38..78e5857337079d9e1556d86b71975ff969892b64 100644 --- a/duniterpy/documents/peer.py +++ b/duniterpy/documents/peer.py @@ -12,18 +12,18 @@ PeerType = TypeVar("PeerType", bound="Peer") class Peer(Document): """ -.. note:: A peer document is specified by the following format : - - | Version: VERSION - | Type: Peer - | Currency: CURRENCY_NAME - | PublicKey: NODE_PUBLICKEY - | Block: BLOCK - | Endpoints: - | END_POINT_1 - | END_POINT_2 - | END_POINT_3 - | [...] + .. note:: A peer document is specified by the following format : + + | Version: VERSION + | Type: Peer + | Currency: CURRENCY_NAME + | PublicKey: NODE_PUBLICKEY + | Block: BLOCK + | Endpoints: + | END_POINT_1 + | END_POINT_2 + | END_POINT_3 + | [...] """ diff --git a/duniterpy/documents/transaction.py b/duniterpy/documents/transaction.py index a4cfc8ee4817d4668a531eb737ad59f3846b6fe6..f0f6447ea6da002e7ddfa604ee5d14893cbc7e7a 100644 --- a/duniterpy/documents/transaction.py +++ b/duniterpy/documents/transaction.py @@ -48,10 +48,10 @@ InputSourceType = TypeVar("InputSourceType", bound="InputSource") class InputSource: """ - A Transaction INPUT + A Transaction INPUT -.. note:: Compact : - INDEX:SOURCE:FINGERPRINT:AMOUNT + .. note:: Compact : + INDEX:SOURCE:FINGERPRINT:AMOUNT """ @@ -448,36 +448,36 @@ TransactionType = TypeVar("TransactionType", bound="Transaction") class Transaction(Document): """ -.. note:: A transaction document is specified by the following format : - - | Document format : - | Version: VERSION - | Type: Transaction - | Currency: CURRENCY_NAME - | Issuers: - | PUBLIC_KEY - | ... - | Inputs: - | INDEX:SOURCE:NUMBER:FINGERPRINT:AMOUNT - | ... - | Outputs: - | PUBLIC_KEY:AMOUNT - | ... - | Comment: COMMENT - | ... - | - | - | Compact format : - | TX:VERSION:NB_ISSUERS:NB_INPUTS:NB_OUTPUTS:HAS_COMMENT - | PUBLIC_KEY:INDEX - | ... - | INDEX:SOURCE:FINGERPRINT:AMOUNT - | ... - | PUBLIC_KEY:AMOUNT - | ... - | COMMENT - | SIGNATURE - | ... + .. note:: A transaction document is specified by the following format : + + | Document format : + | Version: VERSION + | Type: Transaction + | Currency: CURRENCY_NAME + | Issuers: + | PUBLIC_KEY + | ... + | Inputs: + | INDEX:SOURCE:NUMBER:FINGERPRINT:AMOUNT + | ... + | Outputs: + | PUBLIC_KEY:AMOUNT + | ... + | Comment: COMMENT + | ... + | + | + | Compact format : + | TX:VERSION:NB_ISSUERS:NB_INPUTS:NB_OUTPUTS:HAS_COMMENT + | PUBLIC_KEY:INDEX + | ... + | INDEX:SOURCE:FINGERPRINT:AMOUNT + | ... + | PUBLIC_KEY:AMOUNT + | ... + | COMMENT + | SIGNATURE + | ... """ @@ -856,8 +856,7 @@ Currency: {1} ... PUBLIC_KEY:AMOUNT ... - COMMENT -""" + COMMENT""" doc = "TX:{0}:{1}:{2}:{3}:{4}:{5}:{6}\n".format( self.version, len(self.issuers), diff --git a/pyproject.toml b/pyproject.toml index 9075982aad00d3a19e39155fbc2c3109aa1e7290..17e1f9a4d8beffd7cf485821b58d8986116e3960 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ libnacl = "^1.6.1" pyaes = "^1.6.1" [tool.poetry.dev-dependencies] -black = { version = "^19.3b0", python = "^3.6" } +black = { version = "^20.8b1", python = "^3.6" } mypy = "^0.730" pylint = "^2.4.2" sphinx = "^3.0.2"