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
313ec872
Commit
313ec872
authored
2 years ago
by
Moul
Browse files
Options
Downloads
Patches
Plain Diff
[mypy]
#163
: Add type annotation on checksum, cli, and cli_tools
parent
51bcc060
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
silkaj/checksum.py
+1
-1
1 addition, 1 deletion
silkaj/checksum.py
silkaj/cli.py
+15
-15
15 additions, 15 deletions
silkaj/cli.py
silkaj/cli_tools.py
+5
-3
5 additions, 3 deletions
silkaj/cli_tools.py
with
21 additions
and
19 deletions
silkaj/checksum.py
+
1
−
1
View file @
313ec872
...
...
@@ -35,7 +35,7 @@ MESSAGE = "You should specify a pubkey or an authentication method"
Can also check if the checksum is valid
"
,
)
@click.argument
(
"
pubkey_checksum
"
,
nargs
=-
1
)
def
checksum_command
(
pubkey_checksum
)
:
def
checksum_command
(
pubkey_checksum
:
str
)
->
None
:
if
has_auth_method
():
key
=
auth_method
()
click
.
echo
(
gen_pubkey_checksum
(
key
.
pubkey
))
...
...
This diff is collapsed.
Click to expand it.
silkaj/cli.py
+
15
−
15
View file @
313ec872
...
...
@@ -15,7 +15,7 @@
import
sys
from
click
import
group
,
help_option
,
option
,
pass_context
,
version_option
from
click
import
Context
,
group
,
help_option
,
option
,
pass_context
,
version_option
from
duniterpy.api.endpoint
import
endpoint
from
silkaj
import
revocation
...
...
@@ -91,18 +91,18 @@ Do not send the document, but display it instead",
)
@pass_context
def
cli
(
ctx
,
endpoint
,
gtest
,
auth_scrypt
,
nrp
,
auth_file
,
file
,
auth_seed
,
auth_wif
,
display
,
dry_run
,
):
ctx
:
Context
,
endpoint
:
str
,
gtest
:
bool
,
auth_scrypt
:
bool
,
nrp
:
str
,
auth_file
:
bool
,
file
:
str
,
auth_seed
:
bool
,
auth_wif
:
bool
,
display
:
bool
,
dry_run
:
bool
,
)
->
None
:
if
display
and
dry_run
:
sys
.
exit
(
"
ERROR: display and dry-run options can not be used together
"
)
...
...
@@ -143,7 +143,7 @@ cli.add_command(received_sent_certifications)
Subcommands optionally take the path to the revocation document.
"
,
)
@help_option
(
"
-h
"
,
"
--help
"
)
def
revocation_group
():
def
revocation_group
()
->
None
:
pass
...
...
@@ -154,7 +154,7 @@ revocation_group.add_command(revocation.revoke_now)
@cli.command
(
"
about
"
,
help
=
"
Display program information
"
)
def
about
():
def
about
()
->
None
:
print
(
"
\
\n
@@@@@@@@@@@@@
\
...
...
This diff is collapsed.
Click to expand it.
silkaj/cli_tools.py
+
5
−
3
View file @
313ec872
...
...
@@ -13,11 +13,13 @@
# You should have received a copy of the GNU Affero General Public License
# along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
from
click
import
Option
,
UsageError
from
typing
import
Any
from
click
import
Context
,
Option
,
UsageError
class
MutuallyExclusiveOption
(
Option
):
def
__init__
(
self
,
*
args
,
**
kwargs
)
:
def
__init__
(
self
,
*
args
:
Any
,
**
kwargs
:
Any
)
->
None
:
self
.
mutually_exclusive
=
set
(
kwargs
.
pop
(
"
mutually_exclusive
"
,
[]))
help
=
kwargs
.
get
(
"
help
"
,
""
)
if
self
.
mutually_exclusive
:
...
...
@@ -27,7 +29,7 @@ class MutuallyExclusiveOption(Option):
]
=
f
"
{
help
}
NOTE: This argument is mutually exclusive with arguments: [
{
ex_str
}
].
"
super
().
__init__
(
*
args
,
**
kwargs
)
def
handle_parse_result
(
self
,
ctx
,
opts
,
args
)
:
def
handle_parse_result
(
self
,
ctx
:
Context
,
opts
:
Any
,
args
:
Any
)
->
Any
:
if
self
.
mutually_exclusive
.
intersection
(
opts
)
and
self
.
name
in
opts
:
arguments
=
"
,
"
.
join
(
self
.
mutually_exclusive
)
raise
UsageError
(
...
...
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