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
f3a56fd1
Commit
f3a56fd1
authored
4 years ago
by
matograine
Browse files
Options
Downloads
Patches
Plain Diff
[enh]
#203
remove tabulate from commands.py
parent
97599acb
No related branches found
No related tags found
No related merge requests found
Pipeline
#11966
failed
4 years ago
Stage: checks
Stage: tests
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
silkaj/commands.py
+8
-20
8 additions, 20 deletions
silkaj/commands.py
with
8 additions
and
20 deletions
silkaj/commands.py
+
8
−
20
View file @
f3a56fd1
...
@@ -21,14 +21,14 @@ import jsonschema
...
@@ -21,14 +21,14 @@ import jsonschema
from
click
import
command
,
option
,
argument
,
IntRange
from
click
import
command
,
option
,
argument
,
IntRange
from
os
import
system
from
os
import
system
from
collections
import
OrderedDict
from
collections
import
OrderedDict
from
tabulate
import
tabulate
from
operator
import
itemgetter
from
operator
import
itemgetter
from
asyncio
import
sleep
from
asyncio
import
sleep
from
_socket
import
gaierror
from
_socket
import
gaierror
from
duniterpy.api
import
bma
from
duniterpy.api
import
bma
from
silkaj.tools
import
coroutine
from
silkaj
import
tui
from
silkaj.tools
import
coroutine
,
CurrencySymbol
from
silkaj.wot_tools
import
identity_of
from
silkaj.wot_tools
import
identity_of
from
silkaj.network_tools
import
(
from
silkaj.network_tools
import
(
best_endpoint_address
,
best_endpoint_address
,
...
@@ -36,7 +36,6 @@ from silkaj.network_tools import (
...
@@ -36,7 +36,6 @@ from silkaj.network_tools import (
ClientInstance
,
ClientInstance
,
)
)
from
silkaj.blockchain_tools
import
HeadBlock
from
silkaj.blockchain_tools
import
HeadBlock
from
silkaj.tools
import
CurrencySymbol
from
silkaj.constants
import
ASYNC_SLEEP
,
ALL
,
DATE
,
HOUR
from
silkaj.constants
import
ASYNC_SLEEP
,
ALL
,
DATE
,
HOUR
...
@@ -125,6 +124,7 @@ def display_diffi(current, diffi):
...
@@ -125,6 +124,7 @@ def display_diffi(current, diffi):
d
[
"
Π diffi
"
]
=
power
(
match_pattern
(
d
[
"
level
"
])[
1
])
d
[
"
Π diffi
"
]
=
power
(
match_pattern
(
d
[
"
level
"
])[
1
])
d
[
"
Σ diffi
"
]
=
d
.
pop
(
"
level
"
)
d
[
"
Σ diffi
"
]
=
d
.
pop
(
"
level
"
)
system
(
"
cls||clear
"
)
system
(
"
cls||clear
"
)
table
=
tui
.
create_table
(
style
=
"
columns
"
).
set_cols_dtype
([
"
t
"
,
"
t
"
,
"
t
"
,
"
i
"
])
print
(
print
(
"
Current block: n°{0}, generated on the {1}
\n\
"
Current block: n°{0}, generated on the {1}
\n\
Generation of next block n°{2} possible by at least {3}/{4} members
\n\
Generation of next block n°{2} possible by at least {3}/{4} members
\n\
...
@@ -136,9 +136,7 @@ Common Proof-of-Work difficulty level: {5}, hash starting with `{6}`\n{7}".forma
...
@@ -136,9 +136,7 @@ Common Proof-of-Work difficulty level: {5}, hash starting with `{6}`\n{7}".forma
len
(
diffi
[
"
levels
"
]),
len
(
diffi
[
"
levels
"
]),
current
[
"
powMin
"
],
current
[
"
powMin
"
],
match_pattern
(
int
(
current
[
"
powMin
"
]))[
0
],
match_pattern
(
int
(
current
[
"
powMin
"
]))[
0
],
tabulate
(
tui
.
fill_table_from_dict_list
(
table
,
sorted_diffi
),
sorted_diffi
,
headers
=
"
keys
"
,
tablefmt
=
"
orgtbl
"
,
stralign
=
"
center
"
),
)
)
)
)
...
@@ -194,12 +192,8 @@ async def list_blocks(number, detailed):
...
@@ -194,12 +192,8 @@ async def list_blocks(number, detailed):
)
)
if
detailed
or
number
<=
30
:
if
detailed
or
number
<=
30
:
sorted_list
=
sorted
(
issuers
,
key
=
itemgetter
(
"
block
"
),
reverse
=
True
)
sorted_list
=
sorted
(
issuers
,
key
=
itemgetter
(
"
block
"
),
reverse
=
True
)
print
(
table
=
tui
.
create_table
(
style
=
"
columns
"
)
"
\n
"
print
(
"
\n
"
+
tui
.
fill_table_from_dict_list
(
table
,
sorted_list
))
+
tabulate
(
sorted_list
,
headers
=
"
keys
"
,
tablefmt
=
"
orgtbl
"
,
stralign
=
"
center
"
)
)
else
:
else
:
list_issued
=
list
()
list_issued
=
list
()
for
issuer
in
issuers
:
for
issuer
in
issuers
:
...
@@ -217,16 +211,10 @@ async def list_blocks(number, detailed):
...
@@ -217,16 +211,10 @@ async def list_blocks(number, detailed):
for
issued
in
list_issued
:
for
issued
in
list_issued
:
issued
[
"
percent
"
]
=
issued
[
"
blocks
"
]
/
number
*
100
issued
[
"
percent
"
]
=
issued
[
"
blocks
"
]
/
number
*
100
sorted_list
=
sorted
(
list_issued
,
key
=
itemgetter
(
"
blocks
"
),
reverse
=
True
)
sorted_list
=
sorted
(
list_issued
,
key
=
itemgetter
(
"
blocks
"
),
reverse
=
True
)
table
=
tui
.
create_table
(
style
=
"
columns
"
)
print
(
print
(
"
from {0} issuers
\n
{1}
"
.
format
(
"
from {0} issuers
\n
{1}
"
.
format
(
len
(
list_issued
),
len
(
list_issued
),
tui
.
fill_table_from_dict_list
(
table
,
sorted_list
)
tabulate
(
sorted_list
,
headers
=
"
keys
"
,
tablefmt
=
"
orgtbl
"
,
floatfmt
=
"
.1f
"
,
stralign
=
"
center
"
,
),
)
)
)
)
...
...
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