Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DuniterPy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
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
DuniterPy
Commits
a8d394c3
Commit
a8d394c3
authored
6 years ago
by
Vincent Texier
Browse files
Options
Downloads
Patches
Plain Diff
issue
#52
add type hinting to helpers module
parent
90b0501c
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
duniterpy/helpers.py
+4
-3
4 additions, 3 deletions
duniterpy/helpers.py
duniterpy/key/signing_key.py
+3
-2
3 additions, 2 deletions
duniterpy/key/signing_key.py
with
7 additions
and
5 deletions
duniterpy/helpers.py
+
4
−
3
View file @
a8d394c3
from
typing
import
Union
def
ensure_bytes
(
data
)
:
def
ensure_bytes
(
data
:
Union
[
str
,
bytes
])
->
bytes
:
"""
"""
Convert data in bytes if data is a string
Convert data in bytes if data is a string
...
@@ -13,7 +14,7 @@ def ensure_bytes(data):
...
@@ -13,7 +14,7 @@ def ensure_bytes(data):
return
data
return
data
def
ensure_str
(
data
)
:
def
ensure_str
(
data
:
Union
[
str
,
bytes
])
->
str
:
"""
"""
Convert data in str if data are bytes
Convert data in str if data are bytes
...
...
This diff is collapsed.
Click to expand it.
duniterpy/key/signing_key.py
+
3
−
2
View file @
a8d394c3
...
@@ -3,7 +3,7 @@ duniter public and private keys
...
@@ -3,7 +3,7 @@ duniter public and private keys
@author: inso
@author: inso
"""
"""
from
typing
import
Optional
from
typing
import
Optional
,
Union
import
libnacl.sign
import
libnacl.sign
from
pylibscrypt
import
scrypt
from
pylibscrypt
import
scrypt
...
@@ -30,7 +30,8 @@ class ScryptParams:
...
@@ -30,7 +30,8 @@ class ScryptParams:
class
SigningKey
(
libnacl
.
sign
.
Signer
):
class
SigningKey
(
libnacl
.
sign
.
Signer
):
def
__init__
(
self
,
salt
:
str
,
password
:
str
,
scrypt_params
:
Optional
[
ScryptParams
]
=
None
)
->
None
:
def
__init__
(
self
,
salt
:
Union
[
str
,
bytes
],
password
:
Union
[
str
,
bytes
],
scrypt_params
:
Optional
[
ScryptParams
]
=
None
)
->
None
:
"""
"""
Init a SigningKey object from credentials
Init a SigningKey object from credentials
...
...
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