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
2d99d16f
Commit
2d99d16f
authored
4 years ago
by
matograine
Browse files
Options
Downloads
Patches
Plain Diff
[enh]
#203
remove tabulate from wot.py
parent
74dc1489
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
silkaj/wot.py
+15
-11
15 additions, 11 deletions
silkaj/wot.py
with
15 additions
and
11 deletions
silkaj/wot.py
+
15
−
11
View file @
2d99d16f
...
...
@@ -18,7 +18,7 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
import
click
import
pendulum
from
time
import
time
from
tabulate
import
tabulate
from
collections
import
OrderedDict
from
duniterpy.api.bma
import
wot
,
blockchain
from
duniterpy.api.errors
import
DuniterError
...
...
@@ -27,7 +27,12 @@ from silkaj import wot_tools as wt
from
silkaj.network_tools
import
ClientInstance
from
silkaj.crypto_tools
import
is_pubkey_and_check
from
silkaj.tools
import
coroutine
from
silkaj.tui
import
display_pubkey_and_checksum
from
silkaj.tui
import
(
display_pubkey_and_checksum
,
create_table
,
fill_table_from_dict_list
,
fill_table_from_dict
,
)
from
silkaj.blockchain_tools
import
BlockchainParams
from
silkaj.constants
import
DATE
...
...
@@ -87,6 +92,7 @@ async def received_sent_certifications(uid_pubkey):
certifications
[
"
sent_expire
"
],
)
=
get_sent_certifications
(
signed
,
time_first_block
,
params
)
nbr_sent_certs
=
len
(
certifications
[
"
sent
"
])
if
"
sent
"
in
certifications
else
0
table
=
create_table
(
style
=
"
columns
"
)
print
(
"
{0} ({1}) from block #{2}
\n
received {3} and sent {4}/{5} certifications:
\n
{6}
\n
{7}
\n
"
.
format
(
identity
[
"
uid
"
],
...
...
@@ -95,12 +101,7 @@ async def received_sent_certifications(uid_pubkey):
len
(
certifications
[
"
received
"
]),
nbr_sent_certs
,
params
[
"
sigStock
"
],
tabulate
(
certifications
,
headers
=
"
keys
"
,
tablefmt
=
"
orgtbl
"
,
stralign
=
"
center
"
,
),
fill_table_from_dict
(
table
,
certifications
),
"
✔: Certification available to be written or already written into the blockchain
"
,
)
)
...
...
@@ -189,7 +190,9 @@ async def choose_identity(pubkey_uid):
lookups
=
await
wt
.
wot_lookup
(
pubkey_uid
)
# Generate table containing the choices
identities_choices
=
{
"
id
"
:
[],
"
uid
"
:
[],
"
pubkey
"
:
[],
"
timestamp
"
:
[]}
identities_choices
=
OrderedDict
(
[(
"
id
"
,
[]),
(
"
uid
"
,
[]),
(
"
pubkey
"
,
[]),
(
"
timestamp
"
,
[])]
)
for
pubkey_index
,
lookup
in
enumerate
(
lookups
):
for
uid_index
,
identity
in
enumerate
(
lookup
[
"
uids
"
]):
identities_choices
[
"
id
"
].
append
(
str
(
pubkey_index
)
+
str
(
uid_index
))
...
...
@@ -206,9 +209,10 @@ async def choose_identity(pubkey_uid):
pubkey_index
=
0
uid_index
=
0
elif
identities
>
1
:
table
=
tabulate
(
identities_choices
,
headers
=
"
keys
"
,
tablefmt
=
"
orgtbl
"
)
table
=
create_table
()
table
.
set_cols_dtype
([
"
t
"
,
"
t
"
,
"
t
"
,
"
t
"
])
table
=
fill_table_from_dict
(
table
,
identities_choices
)
click
.
echo
(
table
)
# Loop till the passed value is in identities_choices
message
=
"
Which identity would you like to select (id)?
"
selected_id
=
None
...
...
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