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
467002a4
Commit
467002a4
authored
4 years ago
by
matograine
Browse files
Options
Downloads
Patches
Plain Diff
[enh]
#203
remove tabulate from money.py
* import tui module * update balance test
parent
e074b988
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
silkaj/money.py
+10
-8
10 additions, 8 deletions
silkaj/money.py
tests/test_end_to_end.py
+2
-1
2 additions, 1 deletion
tests/test_end_to_end.py
with
12 additions
and
9 deletions
silkaj/money.py
+
10
−
8
View file @
467002a4
...
...
@@ -16,9 +16,9 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
"""
from
click
import
command
,
argument
,
pass_context
,
echo
from
tabulate
import
tabulate
from
silkaj
import
wot_tools
as
wt
from
silkaj
import
tui
from
silkaj.network_tools
import
ClientInstance
from
silkaj.blockchain_tools
import
HeadBlock
from
silkaj.tools
import
CurrencySymbol
,
message_exit
,
coroutine
...
...
@@ -28,7 +28,6 @@ from silkaj.crypto_tools import (
check_pubkey_format
,
validate_checksum
,
)
from
silkaj.tui
import
display_amount
,
display_pubkey_and_checksum
from
duniterpy.api.bma
import
tx
,
blockchain
from
duniterpy.documents.transaction
import
InputSource
...
...
@@ -54,7 +53,7 @@ async def cmd_amount(ctx, pubkeys):
print
(
f
"
ERROR: pubkey
{
inputPubkey
}
has a wrong format
"
)
elif
pubkey
in
pubkeys_list
:
message_exit
(
f
"
ERROR: pubkey
{
display_pubkey_and_checksum
(
pubkey
)
}
was specified many times
"
f
"
ERROR: pubkey
{
tui
.
display_pubkey_and_checksum
(
pubkey
)
}
was specified many times
"
)
pubkeys_list
.
append
(
pubkey
)
if
wrong_pubkeys
:
...
...
@@ -90,7 +89,7 @@ async def show_amount_from_pubkey(label, inputs_balance):
# if `pubkey` is a pubkey, get pubkey:checksum and uid
if
label
!=
"
Total
"
:
member
=
await
wt
.
is_member
(
label
)
label
=
display_pubkey_and_checksum
(
label
)
label
=
tui
.
display_pubkey_and_checksum
(
label
)
# display balance table
display
=
list
()
display
.
append
([
"
Balance of pubkey
"
,
label
])
...
...
@@ -99,22 +98,25 @@ async def show_amount_from_pubkey(label, inputs_balance):
display
.
append
([
"
User identifier
"
,
member
[
"
uid
"
]])
if
totalAmountInput
-
balance
!=
0
:
display_amount
(
display
,
"
Blockchain
"
,
balance
,
ud_value
,
currency_symbol
)
display_amount
(
tui
.
display_amount
(
display
,
"
Blockchain
"
,
balance
,
ud_value
,
currency_symbol
)
tui
.
display_amount
(
display
,
"
Pending transaction
"
,
(
totalAmountInput
-
balance
),
ud_value
,
currency_symbol
,
)
display_amount
(
display
,
"
Total amount
"
,
totalAmountInput
,
ud_value
,
currency_symbol
)
tui
.
display_amount
(
display
,
"
Total amount
"
,
totalAmountInput
,
ud_value
,
currency_symbol
)
display
.
append
(
[
"
Total relative to M/N
"
,
"
{0} x M/N
"
.
format
(
round
(
totalAmountInput
/
average
,
2
)),
]
)
echo
(
tabulate
(
display
,
tablefmt
=
"
fancy_grid
"
))
table
=
tui
.
create_table
()
echo
(
tui
.
vert_table
(
table
,
display
))
async
def
get_average
():
...
...
This diff is collapsed.
Click to expand it.
tests/test_end_to_end.py
+
2
−
1
View file @
467002a4
...
...
@@ -51,8 +51,9 @@ def test_balance():
output
=
check_output
(
silkaj
+
[
"
--gtest
"
,
"
balance
"
,
"
3dnbnYY9i2bHMQUGyFp5GVvJ2wBkVpus31cDJA5cfRpj
"
]
).
decode
()
print
(
output
)
# debug
assert
(
"
│ Balance of pubkey │ 3dnbnYY9i2bHMQUGyFp5GVvJ2wBkVpus31cDJA5cfRpj:
EyF
│
"
"
│ Balance of pubkey │ 3dnbnYY9i2bHMQUGyFp5GVvJ2wBkVpus31cDJA5cfRpj: │
"
in
output
)
assert
"
│ Total amount (unit|relative) │
"
in
output
...
...
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