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
ad958fe9
Commit
ad958fe9
authored
3 years ago
by
Moul
Browse files
Options
Downloads
Patches
Plain Diff
[mod]
#194
: money/tui: Use f-string
parent
89f6b9de
No related branches found
No related tags found
1 merge request
!195
#194, #376: Use f-string and sys.exit()
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
silkaj/money.py
+2
-2
2 additions, 2 deletions
silkaj/money.py
silkaj/tui.py
+8
-11
8 additions, 11 deletions
silkaj/tui.py
with
10 additions
and
13 deletions
silkaj/money.py
+
2
−
2
View file @
ad958fe9
...
...
@@ -138,7 +138,7 @@ def get_sources(pubkey):
listinput
=
list
()
amount
=
0
for
source
in
sources
[
"
sources
"
]:
if
source
[
"
conditions
"
]
==
"
SIG(
"
+
pubkey
+
"
)
"
:
if
source
[
"
conditions
"
]
==
f
"
SIG(
{
pubkey
}
)
"
:
listinput
.
append
(
InputSource
(
amount
=
source
[
"
amount
"
],
...
...
@@ -161,7 +161,7 @@ def get_sources(pubkey):
identifier
=
pending
[
"
hash
"
]
for
i
,
output
in
enumerate
(
pending
[
"
outputs
"
]):
outputsplited
=
output
.
split
(
"
:
"
)
if
outputsplited
[
2
]
==
"
SIG(
"
+
pubkey
+
"
)
"
:
if
outputsplited
[
2
]
==
f
"
SIG(
{
pubkey
}
)
"
:
inputgenerated
=
InputSource
(
amount
=
int
(
outputsplited
[
0
]),
base
=
int
(
outputsplited
[
1
]),
...
...
This diff is collapsed.
Click to expand it.
silkaj/tui.py
+
8
−
11
View file @
ad958fe9
...
...
@@ -27,15 +27,12 @@ def display_amount(tx, message, amount, ud_value, currency_symbol):
"""
Displays an amount in unit and relative reference.
"""
amount_UD
=
round
((
amount
/
ud_value
),
2
)
UD_amount
=
str
(
round
((
amount
/
ud_value
),
2
))
unit_amount
=
str
(
amount
/
100
)
tx
.
append
(
[
message
+
"
(unit|relative)
"
,
"
{unit_amount} {currency_symbol} | {UD_amount} UD {currency_symbol}
"
.
format
(
unit_amount
=
str
(
amount
/
100
),
currency_symbol
=
currency_symbol
,
UD_amount
=
str
(
amount_UD
),
),
f
"
{
message
}
(unit|relative)
"
,
f
"
{
unit_amount
}
{
currency_symbol
}
|
{
UD_amount
}
UD
{
currency_symbol
}
"
,
]
)
...
...
@@ -44,10 +41,10 @@ def display_pubkey(tx, message, pubkey):
"""
Displays a pubkey and the eventually associated id.
"""
tx
.
append
([
message
+
"
(pubkey:checksum)
"
,
display_pubkey_and_checksum
(
pubkey
)])
tx
.
append
([
f
"
{
message
}
(pubkey:checksum)
"
,
display_pubkey_and_checksum
(
pubkey
)])
id
=
wot_tools
.
is_member
(
pubkey
)
if
id
:
tx
.
append
([
message
+
"
(id)
"
,
id
[
"
uid
"
]])
tx
.
append
([
f
"
{
message
}
(id)
"
,
id
[
"
uid
"
]])
def
display_pubkey_and_checksum
(
...
...
@@ -58,8 +55,8 @@ def display_pubkey_and_checksum(
returns `length` first chars of pubkey and checksum in short form.
`length` defaults to SHORT_PUBKEY_SIZE.
"""
short_pubkey
=
pubkey
[:
length
]
+
"
…
"
if
short
else
pubkey
return
short_pubkey
+
"
:
"
+
ct
.
gen_checksum
(
pubkey
)
short_pubkey
=
f
"
{
pubkey
[
:
length
]
}
…
"
if
short
else
pubkey
return
f
"
{
short_pubkey
}
:
{
ct
.
gen_checksum
(
pubkey
)
}
"
def
send_doc_confirmation
(
document_name
):
...
...
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