From b418e8a742664b2ba3aae3602855d4da5d3207c9 Mon Sep 17 00:00:00 2001
From: Vincent Texier <vit@free.fr>
Date: Wed, 17 Apr 2019 12:29:40 +0200
Subject: [PATCH] [enh] enhance indentation and others minors things

---
 duniterpy/api/endpoint.py          |  4 ++--
 duniterpy/documents/block.py       | 10 +++++-----
 duniterpy/documents/transaction.py | 28 +++++++++++-----------------
 3 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/duniterpy/api/endpoint.py b/duniterpy/api/endpoint.py
index c70a47a3..a782c62b 100644
--- a/duniterpy/api/endpoint.py
+++ b/duniterpy/api/endpoint.py
@@ -206,7 +206,7 @@ class BMAEndpoint(Endpoint):
         if not isinstance(other, BMAEndpoint):
             return NotImplemented
         return self.server == other.server and self.ipv4 == other.ipv4 \
-                   and self.ipv6 == other.ipv6 and self.port == other.port
+            and self.ipv6 == other.ipv6 and self.port == other.port
 
     def __hash__(self) -> int:
         return hash((self.server, self.ipv4, self.ipv6, self.port))
@@ -348,7 +348,7 @@ class WS2PEndpoint(Endpoint):
         if not isinstance(other, WS2PEndpoint):
             return NotImplemented
         return self.server == other.server and self.ws2pid == other.ws2pid \
-                   and self.port == other.port and self.path == other.path
+            and self.port == other.port and self.path == other.path
 
     def __hash__(self) -> int:
         return hash((self.ws2pid, self.server, self.port, self.path))
diff --git a/duniterpy/documents/block.py b/duniterpy/documents/block.py
index 634332e7..9ec967da 100644
--- a/duniterpy/documents/block.py
+++ b/duniterpy/documents/block.py
@@ -70,14 +70,14 @@ The class Block handles Block documents.
     re_unitbase = re.compile("UnitBase: ([0-9]+)\n")
     re_issuer = re.compile("Issuer: ({pubkey_regex})\n".format(pubkey_regex=PUBKEY_REGEX))
     re_issuers_frame = re.compile("IssuersFrame: ([0-9]+)\n")
-    re_issuers_frame_var = re.compile("IssuersFrameVar: (0|-?[1-9]\d{0,18})\n")
+    re_issuers_frame_var = re.compile("IssuersFrameVar: (0|-?[1-9]\\d{0,18})\n")
     re_different_issuers_count = re.compile("DifferentIssuersCount: ([0-9]+)\n")
     re_previoushash = re.compile("PreviousHash: ({block_hash_regex})\n".format(block_hash_regex=BLOCK_HASH_REGEX))
     re_previousissuer = re.compile("PreviousIssuer: ({pubkey_regex})\n".format(pubkey_regex=PUBKEY_REGEX))
-    re_parameters = re.compile("Parameters: ([0-9]+\.[0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):\
-([0-9]+):([0-9]+):([0-9]+\.[0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+\.[0-9]+)\n")
-    re_parameters_v10 = re.compile("Parameters: ([0-9]+\.[0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):\
-([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+\.[0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+\.[0-9]+):\
+    re_parameters = re.compile("Parameters: ([0-9]+\\.[0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):\
+([0-9]+):([0-9]+):([0-9]+\\.[0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+\\.[0-9]+)\n")
+    re_parameters_v10 = re.compile("Parameters: ([0-9]+\\.[0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):\
+([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+\\.[0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+\\.[0-9]+):\
 ([0-9]+):([0-9]+):([0-9]+)\n")
     re_memberscount = re.compile("MembersCount: ([0-9]+)\n")
     re_identities = re.compile("Identities:\n")
diff --git a/duniterpy/documents/transaction.py b/duniterpy/documents/transaction.py
index 93115211..fa3f19af 100644
--- a/duniterpy/documents/transaction.py
+++ b/duniterpy/documents/transaction.py
@@ -78,24 +78,21 @@ class InputSource:
         self.origin_id = origin_id
         self.index = index
 
-
     def __eq__(self, other: Any) -> bool:
         """
         Check InputSource instances equality
         """
         if not isinstance(other, InputSource):
             return NotImplemented
-        return self.amount == other.amount and\
-        self.base == other.base and\
-        self.source == other.source and\
-        self.origin_id == other.origin_id and\
-        self.index == other.index
-
+        return self.amount == other.amount and \
+            self.base == other.base and \
+            self.source == other.source and \
+            self.origin_id == other.origin_id and \
+            self.index == other.index
 
     def __hash__(self) -> int:
         return hash((self.amount, self.base, self.source, self.origin_id, self.index))
 
-
     @classmethod
     def from_inline(cls: Type[InputSourceType], tx_version: int, inline: str) -> InputSourceType:
         """
@@ -171,22 +168,19 @@ class OutputSource:
         self.base = base
         self.condition = self.condition_from_text(condition)
 
-
     def __eq__(self, other: Any) -> bool:
         """
         Check OutputSource instances equality
         """
         if not isinstance(other, OutputSource):
             return NotImplemented
-        return self.amount == other.amount and\
-        self.base == other.base and\
-        self.condition == other.condition
-
+        return self.amount == other.amount and \
+            self.base == other.base and \
+            self.condition == other.condition
 
     def __hash__(self) -> int:
         return hash((self.amount, self.base, self.condition))
 
-
     @classmethod
     def from_inline(cls: Type[OutputSourceType], inline: str) -> OutputSourceType:
         """
@@ -238,7 +232,7 @@ class SIGParameter:
     """
     A Transaction UNLOCK SIG parameter
     """
-    re_sig = re.compile("SIG\(([0-9]+)\)")
+    re_sig = re.compile("SIG\\(([0-9]+)\\)")
 
     def __init__(self, index: int) -> None:
         """
@@ -280,7 +274,7 @@ class XHXParameter:
     """
     A Transaction UNLOCK XHX parameter
     """
-    re_xhx = re.compile("XHX\(([0-9]+)\)")
+    re_xhx = re.compile("XHX\\(([0-9]+)\\)")
 
     def __init__(self, integer: int) -> None:
         """
@@ -354,7 +348,7 @@ class Unlock:
     """
     A Transaction UNLOCK
     """
-    re_inline = re.compile("([0-9]+):((?:SIG\([0-9]+\)|XHX\([0-9]+\)|\s)+)\n")
+    re_inline = re.compile("([0-9]+):((?:SIG\\([0-9]+\\)|XHX\\([0-9]+\\)|\\s)+)\n")
 
     def __init__(self, index: int, parameters: List[Union[SIGParameter, XHXParameter]]) -> None:
         """
-- 
GitLab