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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
DuniterPy
Commits
4c30cf3f
Commit
4c30cf3f
authored
6 years ago
by
Moul
Browse files
Options
Downloads
Patches
Plain Diff
[feat] InputSource: add equality and hash methods
parent
dc87cc75
No related branches found
No related tags found
1 merge request
!55
Implement InputSource and OutputSource equality and hash methods
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
duniterpy/documents/transaction.py
+19
-1
19 additions, 1 deletion
duniterpy/documents/transaction.py
with
19 additions
and
1 deletion
duniterpy/documents/transaction.py
+
19
−
1
View file @
4c30cf3f
import
re
import
re
from
typing
import
TypeVar
,
List
,
Type
,
Optional
,
Dict
,
Union
from
typing
import
TypeVar
,
List
,
Any
,
Type
,
Optional
,
Dict
,
Union
import
pypeg2
import
pypeg2
...
@@ -78,6 +78,24 @@ class InputSource:
...
@@ -78,6 +78,24 @@ class InputSource:
self
.
origin_id
=
origin_id
self
.
origin_id
=
origin_id
self
.
index
=
index
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
def
__hash__
(
self
)
->
int
:
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
:
"""
"""
...
...
This diff is collapsed.
Click to expand it.
Moul
@moul
mentioned in issue
silkaj#178 (closed)
·
6 years ago
mentioned in issue
silkaj#178 (closed)
mentioned in issue silkaj#178
Toggle commit list
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