Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DuniterPy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
DuniterPy
Commits
b418e8a7
Commit
b418e8a7
authored
6 years ago
by
Vincent Texier
Browse files
Options
Downloads
Patches
Plain Diff
[enh] enhance indentation and others minors things
parent
dce62484
No related branches found
No related tags found
1 merge request
!55
Implement InputSource and OutputSource equality and hash methods
Pipeline
#5238
passed
6 years ago
Stage: github-sync
Stage: build
Stage: test
Stage: release
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
duniterpy/api/endpoint.py
+2
-2
2 additions, 2 deletions
duniterpy/api/endpoint.py
duniterpy/documents/block.py
+5
-5
5 additions, 5 deletions
duniterpy/documents/block.py
duniterpy/documents/transaction.py
+11
-17
11 additions, 17 deletions
duniterpy/documents/transaction.py
with
18 additions
and
24 deletions
duniterpy/api/endpoint.py
+
2
−
2
View file @
b418e8a7
This diff is collapsed.
Click to expand it.
duniterpy/documents/block.py
+
5
−
5
View file @
b418e8a7
...
@@ -70,14 +70,14 @@ The class Block handles Block documents.
...
@@ -70,14 +70,14 @@ The class Block handles Block documents.
re_unitbase
=
re
.
compile
(
"
UnitBase: ([0-9]+)
\n
"
)
re_unitbase
=
re
.
compile
(
"
UnitBase: ([0-9]+)
\n
"
)
re_issuer
=
re
.
compile
(
"
Issuer: ({pubkey_regex})
\n
"
.
format
(
pubkey_regex
=
PUBKEY_REGEX
))
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
=
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_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_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_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]+):
\
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
"
)
([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]+):
\
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]+):([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
"
)
([0-9]+):([0-9]+):([0-9]+)
\n
"
)
re_memberscount
=
re
.
compile
(
"
MembersCount: ([0-9]+)
\n
"
)
re_memberscount
=
re
.
compile
(
"
MembersCount: ([0-9]+)
\n
"
)
re_identities
=
re
.
compile
(
"
Identities:
\n
"
)
re_identities
=
re
.
compile
(
"
Identities:
\n
"
)
...
...
This diff is collapsed.
Click to expand it.
duniterpy/documents/transaction.py
+
11
−
17
View file @
b418e8a7
...
@@ -78,7 +78,6 @@ class InputSource:
...
@@ -78,7 +78,6 @@ class InputSource:
self
.
origin_id
=
origin_id
self
.
origin_id
=
origin_id
self
.
index
=
index
self
.
index
=
index
def
__eq__
(
self
,
other
:
Any
)
->
bool
:
def
__eq__
(
self
,
other
:
Any
)
->
bool
:
"""
"""
Check InputSource instances equality
Check InputSource instances equality
...
@@ -91,11 +90,9 @@ class InputSource:
...
@@ -91,11 +90,9 @@ class InputSource:
self
.
origin_id
==
other
.
origin_id
and
\
self
.
origin_id
==
other
.
origin_id
and
\
self
.
index
==
other
.
index
self
.
index
==
other
.
index
def
__hash__
(
self
)
->
int
:
def
__hash__
(
self
)
->
int
:
return
hash
((
self
.
amount
,
self
.
base
,
self
.
source
,
self
.
origin_id
,
self
.
index
))
return
hash
((
self
.
amount
,
self
.
base
,
self
.
source
,
self
.
origin_id
,
self
.
index
))
@classmethod
@classmethod
def
from_inline
(
cls
:
Type
[
InputSourceType
],
tx_version
:
int
,
inline
:
str
)
->
InputSourceType
:
def
from_inline
(
cls
:
Type
[
InputSourceType
],
tx_version
:
int
,
inline
:
str
)
->
InputSourceType
:
"""
"""
...
@@ -171,7 +168,6 @@ class OutputSource:
...
@@ -171,7 +168,6 @@ class OutputSource:
self
.
base
=
base
self
.
base
=
base
self
.
condition
=
self
.
condition_from_text
(
condition
)
self
.
condition
=
self
.
condition_from_text
(
condition
)
def
__eq__
(
self
,
other
:
Any
)
->
bool
:
def
__eq__
(
self
,
other
:
Any
)
->
bool
:
"""
"""
Check OutputSource instances equality
Check OutputSource instances equality
...
@@ -182,11 +178,9 @@ class OutputSource:
...
@@ -182,11 +178,9 @@ class OutputSource:
self
.
base
==
other
.
base
and
\
self
.
base
==
other
.
base
and
\
self
.
condition
==
other
.
condition
self
.
condition
==
other
.
condition
def
__hash__
(
self
)
->
int
:
def
__hash__
(
self
)
->
int
:
return
hash
((
self
.
amount
,
self
.
base
,
self
.
condition
))
return
hash
((
self
.
amount
,
self
.
base
,
self
.
condition
))
@classmethod
@classmethod
def
from_inline
(
cls
:
Type
[
OutputSourceType
],
inline
:
str
)
->
OutputSourceType
:
def
from_inline
(
cls
:
Type
[
OutputSourceType
],
inline
:
str
)
->
OutputSourceType
:
"""
"""
...
@@ -238,7 +232,7 @@ class SIGParameter:
...
@@ -238,7 +232,7 @@ class SIGParameter:
"""
"""
A Transaction UNLOCK SIG parameter
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
:
def
__init__
(
self
,
index
:
int
)
->
None
:
"""
"""
...
@@ -280,7 +274,7 @@ class XHXParameter:
...
@@ -280,7 +274,7 @@ class XHXParameter:
"""
"""
A Transaction UNLOCK XHX parameter
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
:
def
__init__
(
self
,
integer
:
int
)
->
None
:
"""
"""
...
@@ -354,7 +348,7 @@ class Unlock:
...
@@ -354,7 +348,7 @@ class Unlock:
"""
"""
A Transaction 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
:
def
__init__
(
self
,
index
:
int
,
parameters
:
List
[
Union
[
SIGParameter
,
XHXParameter
]])
->
None
:
"""
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment