Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-model
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
Platform
Development
swh-model
Commits
50d03102
Commit
50d03102
authored
1 year ago
by
David Douard
Browse files
Options
Downloads
Patches
Plain Diff
Fix annotations for mypy 1.4 (py37)
parent
ad6a532a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!340
Migrate to copier-based template
Pipeline
#5708
passed
1 year ago
Stage: external
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
swh/model/cli.py
+6
-4
6 additions, 4 deletions
swh/model/cli.py
swh/model/collections.py
+2
-2
2 additions, 2 deletions
swh/model/collections.py
tox.ini
+1
-1
1 addition, 1 deletion
tox.ini
with
9 additions
and
7 deletions
swh/model/cli.py
+
6
−
4
View file @
50d03102
...
...
@@ -20,10 +20,12 @@ except ImportError:
exit
(
1
)
try
:
from
swh.core.cli
import
swh
as
swh_cli_group
import
swh.core.cli
cli_command
=
swh
.
core
.
cli
.
swh
.
command
except
ImportError
:
# stub so that swh-identify can be used when swh-core isn't installed
swh_cli_group
=
click
# type: ignore
cli_command
=
click
.
command
from
swh.model.from_disk
import
Directory
from
swh.model.swhids
import
CoreSWHID
...
...
@@ -175,7 +177,7 @@ def identify_object(
return
swhid
@
swh_cli_group.
command
(
context_settings
=
CONTEXT_SETTINGS
)
@
cli_
command
(
context_settings
=
CONTEXT_SETTINGS
)
@click.option
(
"
--dereference/--no-dereference
"
,
"
follow_symlinks
"
,
...
...
@@ -304,7 +306,7 @@ def identify(
click
.
echo
(
"
SWHID mismatch: %s != %s
"
%
(
verify
,
swhid
))
sys
.
exit
(
1
)
else
:
for
(
obj
,
swhid
)
in
results
:
for
obj
,
swhid
in
results
:
msg
=
swhid
if
show_filename
:
msg
=
"
%s
\t
%s
"
%
(
swhid
,
os
.
fsdecode
(
obj
))
...
...
This diff is collapsed.
Click to expand it.
swh/model/collections.py
+
2
−
2
View file @
50d03102
...
...
@@ -45,7 +45,7 @@ class ImmutableDict(Mapping, Generic[KT, VT]):
return
self
.
_data
[
key
]
def
__iter__
(
self
):
for
(
k
,
v
)
in
self
.
data
:
for
k
,
v
in
self
.
data
:
yield
k
def
__len__
(
self
):
...
...
@@ -61,5 +61,5 @@ class ImmutableDict(Mapping, Generic[KT, VT]):
"""
Returns a copy of this ImmutableDict without the given key,
as well as the value associated to the key.
"""
new_items
=
copy
.
deepcopy
(
self
.
_data
)
popped_value
=
new_items
.
pop
(
popped_key
,
None
)
popped_value
:
Optional
[
VT
]
=
new_items
.
pop
(
popped_key
,
None
)
return
(
popped_value
,
ImmutableDict
(
new_items
))
This diff is collapsed.
Click to expand it.
tox.ini
+
1
−
1
View file @
50d03102
...
...
@@ -48,7 +48,7 @@ commands =
extras
=
testing
deps
=
mypy
=
=1.0.1
mypy
>1.4
commands
=
mypy
swh
...
...
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