From ef72eeb27f1ffcc0066e3ff0640a2c5ad21c2a37 Mon Sep 17 00:00:00 2001 From: Moul <moul@moul.re> Date: Mon, 7 Sep 2020 19:16:38 +0200 Subject: [PATCH] [dep] Update black to v20.8b1, format code --- duniterpy/constants.py | 6 ++- duniterpy/documents/block.py | 80 +++++++++++++++--------------- duniterpy/documents/membership.py | 20 ++++---- duniterpy/documents/peer.py | 24 ++++----- duniterpy/documents/transaction.py | 69 +++++++++++++------------- pyproject.toml | 2 +- 6 files changed, 101 insertions(+), 100 deletions(-) diff --git a/duniterpy/constants.py b/duniterpy/constants.py index c76c9962..626f3382 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 7cf69ef4..62a4e273 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 ddf245b7..632a0221 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 bc26cdbc..78e58573 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 a4cfc8ee..f0f6447e 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 9075982a..17e1f9a4 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" -- GitLab