Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
silkaj
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
silkaj
Commits
3063ef4d
Commit
3063ef4d
authored
2 years ago
by
matograine
Committed by
Moul
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[mod]
#203
reformat tx_history: rename generate_table to generate_txs_list
parent
329896a5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!199
#203: Harmonize tables style using Texttable
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
silkaj/tx_history.py
+8
-8
8 additions, 8 deletions
silkaj/tx_history.py
tests/test_tx_history.py
+5
-5
5 additions, 5 deletions
tests/test_tx_history.py
with
13 additions
and
13 deletions
silkaj/tx_history.py
+
8
−
8
View file @
3063ef4d
...
@@ -50,7 +50,7 @@ def transaction_history(pubkey: str, uids: bool, full_pubkey: bool) -> None:
...
@@ -50,7 +50,7 @@ def transaction_history(pubkey: str, uids: bool, full_pubkey: bool) -> None:
get_transactions_history
(
client
,
pubkey
,
received_txs
,
sent_txs
)
get_transactions_history
(
client
,
pubkey
,
received_txs
,
sent_txs
)
remove_duplicate_txs
(
received_txs
,
sent_txs
)
remove_duplicate_txs
(
received_txs
,
sent_txs
)
txs_list
=
generate_t
able
(
txs_list
=
generate_t
xs_list
(
received_txs
,
sent_txs
,
pubkey
,
ud_value
,
currency_symbol
,
uids
,
full_pubkey
received_txs
,
sent_txs
,
pubkey
,
ud_value
,
currency_symbol
,
uids
,
full_pubkey
)
)
table_headers
=
[
table_headers
=
[
...
@@ -105,7 +105,7 @@ def remove_duplicate_txs(received_txs: List, sent_txs: List) -> None:
...
@@ -105,7 +105,7 @@ def remove_duplicate_txs(received_txs: List, sent_txs: List) -> None:
received_txs
.
remove
(
received_tx
)
received_txs
.
remove
(
received_tx
)
def
generate_t
able
(
def
generate_t
xs_list
(
received_txs
:
List
[
Transaction
],
received_txs
:
List
[
Transaction
],
sent_txs
:
List
[
Transaction
],
sent_txs
:
List
[
Transaction
],
pubkey
:
str
,
pubkey
:
str
,
...
@@ -120,18 +120,18 @@ def generate_table(
...
@@ -120,18 +120,18 @@ def generate_table(
Sort txs temporarily
Sort txs temporarily
"""
"""
received_txs_
table
,
sent_txs_
table
=
(
received_txs_
list
,
sent_txs_
list
=
(
[],
[],
[],
[],
)
# type: List[Transaction], List[Transaction]
)
# type: List[Transaction], List[Transaction]
parse_received_tx
(
parse_received_tx
(
received_txs_
table
,
received_txs
,
pubkey
,
ud_value
,
uids
,
full_pubkey
received_txs_
list
,
received_txs
,
pubkey
,
ud_value
,
uids
,
full_pubkey
)
)
parse_sent_tx
(
sent_txs_
table
,
sent_txs
,
pubkey
,
ud_value
,
uids
,
full_pubkey
)
parse_sent_tx
(
sent_txs_
list
,
sent_txs
,
pubkey
,
ud_value
,
uids
,
full_pubkey
)
txs_
table
=
received_txs_
table
+
sent_txs_
table
txs_
list
=
received_txs_
list
+
sent_txs_
list
txs_
table
.
sort
(
key
=
itemgetter
(
0
),
reverse
=
True
)
txs_
list
.
sort
(
key
=
itemgetter
(
0
),
reverse
=
True
)
return
txs_
table
return
txs_
list
def
parse_received_tx
(
def
parse_received_tx
(
...
...
This diff is collapsed.
Click to expand it.
tests/test_tx_history.py
+
5
−
5
View file @
3063ef4d
...
@@ -35,7 +35,7 @@ MAX_FULL_PUBKEY_LENGTH_WITH_CHECKSUM = (
...
@@ -35,7 +35,7 @@ MAX_FULL_PUBKEY_LENGTH_WITH_CHECKSUM = (
)
# char `:` ==> 44 + 3 + 1 = 48
)
# char `:` ==> 44 + 3 + 1 = 48
def
test_tx_history_generate_t
able
_and_pubkey_uid_display
(
monkeypatch
):
def
test_tx_history_generate_t
xs_list
_and_pubkey_uid_display
(
monkeypatch
):
def
min_pubkey_length_with_uid
(
pubkey
):
def
min_pubkey_length_with_uid
(
pubkey
):
# uid is at least one char : "<uid> - <pubkey>" adds min 4 chars to <pubkey>
# uid is at least one char : "<uid> - <pubkey>" adds min 4 chars to <pubkey>
return
pubkey
+
4
return
pubkey
+
4
...
@@ -53,7 +53,7 @@ def test_tx_history_generate_table_and_pubkey_uid_display(monkeypatch):
...
@@ -53,7 +53,7 @@ def test_tx_history_generate_table_and_pubkey_uid_display(monkeypatch):
patched_get_transactions_history
(
client
,
pubkey
,
received_txs
,
sent_txs
)
patched_get_transactions_history
(
client
,
pubkey
,
received_txs
,
sent_txs
)
# simple table
# simple table
txs_list
=
tx_history
.
generate_t
able
(
txs_list
=
tx_history
.
generate_t
xs_list
(
received_txs
,
received_txs
,
sent_txs
,
sent_txs
,
pubkey
,
pubkey
,
...
@@ -68,7 +68,7 @@ def test_tx_history_generate_table_and_pubkey_uid_display(monkeypatch):
...
@@ -68,7 +68,7 @@ def test_tx_history_generate_table_and_pubkey_uid_display(monkeypatch):
assert
len
(
tx_list
[
1
])
==
SHORT_PUBKEY_LENGTH_WITH_CHECKSUM
assert
len
(
tx_list
[
1
])
==
SHORT_PUBKEY_LENGTH_WITH_CHECKSUM
# with uids
# with uids
txs_list_uids
=
tx_history
.
generate_t
able
(
txs_list_uids
=
tx_history
.
generate_t
xs_list
(
received_txs
,
received_txs
,
sent_txs
,
sent_txs
,
pubkey
,
pubkey
,
...
@@ -91,7 +91,7 @@ def test_tx_history_generate_table_and_pubkey_uid_display(monkeypatch):
...
@@ -91,7 +91,7 @@ def test_tx_history_generate_table_and_pubkey_uid_display(monkeypatch):
assert
len
(
txs_list_uids
[
3
][
1
])
==
SHORT_PUBKEY_LENGTH_WITH_CHECKSUM
assert
len
(
txs_list_uids
[
3
][
1
])
==
SHORT_PUBKEY_LENGTH_WITH_CHECKSUM
# with full pubkeys
# with full pubkeys
txs_list_full
=
tx_history
.
generate_t
able
(
txs_list_full
=
tx_history
.
generate_t
xs_list
(
received_txs
,
received_txs
,
sent_txs
,
sent_txs
,
pubkey
,
pubkey
,
...
@@ -111,7 +111,7 @@ def test_tx_history_generate_table_and_pubkey_uid_display(monkeypatch):
...
@@ -111,7 +111,7 @@ def test_tx_history_generate_table_and_pubkey_uid_display(monkeypatch):
)
)
# with full pubkeys and uids
# with full pubkeys and uids
txs_list_uids_full
=
tx_history
.
generate_t
able
(
txs_list_uids_full
=
tx_history
.
generate_t
xs_list
(
received_txs
,
received_txs
,
sent_txs
,
sent_txs
,
pubkey
,
pubkey
,
...
...
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