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
3f79a760
Commit
3f79a760
authored
2 years ago
by
Moul
Browse files
Options
Downloads
Patches
Plain Diff
[mypy]
#163
: Add type annotation on wot_tools
parent
b46ff8e9
No related branches found
No related tags found
1 merge request
!214
#163: Introduce mypy
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
silkaj/wot_tools.py
+7
-5
7 additions, 5 deletions
silkaj/wot_tools.py
with
7 additions
and
5 deletions
silkaj/wot_tools.py
+
7
−
5
View file @
3f79a760
...
@@ -13,12 +13,14 @@
...
@@ -13,12 +13,14 @@
# You should have received a copy of the GNU Affero General Public License
# You should have received a copy of the GNU Affero General Public License
# along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
# along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
from
typing
import
Dict
,
List
,
Optional
from
duniterpy.api.bma
import
wot
from
duniterpy.api.bma
import
wot
from
silkaj.network_tools
import
client_instance
from
silkaj.network_tools
import
client_instance
def
identity_of
(
pubkey_uid
)
:
def
identity_of
(
pubkey_uid
:
str
)
->
Dict
:
"""
"""
Only works for members
Only works for members
Not able to get corresponding uid from a non-member identity
Not able to get corresponding uid from a non-member identity
...
@@ -31,7 +33,7 @@ def identity_of(pubkey_uid):
...
@@ -31,7 +33,7 @@ def identity_of(pubkey_uid):
pass
pass
def
is_member
(
pubkey_uid
)
:
def
is_member
(
pubkey_uid
:
str
)
->
Optional
[
Dict
]
:
"""
"""
Check identity is member
Check identity is member
If member, return corresponding identity, else: False
If member, return corresponding identity, else: False
...
@@ -39,10 +41,10 @@ def is_member(pubkey_uid):
...
@@ -39,10 +41,10 @@ def is_member(pubkey_uid):
try
:
try
:
return
identity_of
(
pubkey_uid
)
return
identity_of
(
pubkey_uid
)
except
Exception
:
except
Exception
:
return
Fals
e
return
Non
e
def
wot_lookup
(
identifier
)
:
def
wot_lookup
(
identifier
:
str
)
->
List
:
"""
"""
:identifier: identity or pubkey in part or whole
:identifier: identity or pubkey in part or whole
Return received and sent certifications lists of matching identities
Return received and sent certifications lists of matching identities
...
@@ -52,7 +54,7 @@ def wot_lookup(identifier):
...
@@ -52,7 +54,7 @@ def wot_lookup(identifier):
return
(
client
(
wot
.
lookup
,
identifier
))[
"
results
"
]
return
(
client
(
wot
.
lookup
,
identifier
))[
"
results
"
]
def
identities_from_pubkeys
(
pubkeys
,
uids
)
:
def
identities_from_pubkeys
(
pubkeys
:
List
[
str
],
uids
:
bool
)
->
List
:
"""
"""
Make list of pubkeys unique, and remove empty strings
Make list of pubkeys unique, and remove empty strings
Request identities
Request identities
...
...
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