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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Renaud Boyer
swh-model
Commits
cd2b4090
Commit
cd2b4090
authored
2 years ago
by
Antoine Lambert
Browse files
Options
Downloads
Patches
Plain Diff
mypy: Bump to 1.0 and fix new typing errors
Related to
swh/meta#4960
parent
6375f8e9
No related branches found
Branches containing commit
Tags
v6.6.3
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
swh/model/cli.py
+6
-2
6 additions, 2 deletions
swh/model/cli.py
swh/model/model.py
+2
-6
2 additions, 6 deletions
swh/model/model.py
tox.ini
+1
-1
1 addition, 1 deletion
tox.ini
with
9 additions
and
9 deletions
swh/model/cli.py
+
6
−
2
View file @
cd2b4090
...
@@ -69,7 +69,9 @@ def swhid_of_file_content(data) -> CoreSWHID:
...
@@ -69,7 +69,9 @@ def swhid_of_file_content(data) -> CoreSWHID:
return
object
.
swhid
()
return
object
.
swhid
()
def
model_of_dir
(
path
:
bytes
,
exclude_patterns
:
Iterable
[
bytes
]
=
None
)
->
Directory
:
def
model_of_dir
(
path
:
bytes
,
exclude_patterns
:
Optional
[
Iterable
[
bytes
]]
=
None
)
->
Directory
:
from
swh.model.from_disk
import
accept_all_directories
,
ignore_directories_patterns
from
swh.model.from_disk
import
accept_all_directories
,
ignore_directories_patterns
dir_filter
=
(
dir_filter
=
(
...
@@ -81,7 +83,9 @@ def model_of_dir(path: bytes, exclude_patterns: Iterable[bytes] = None) -> Direc
...
@@ -81,7 +83,9 @@ def model_of_dir(path: bytes, exclude_patterns: Iterable[bytes] = None) -> Direc
return
Directory
.
from_disk
(
path
=
path
,
dir_filter
=
dir_filter
)
return
Directory
.
from_disk
(
path
=
path
,
dir_filter
=
dir_filter
)
def
swhid_of_dir
(
path
:
bytes
,
exclude_patterns
:
Iterable
[
bytes
]
=
None
)
->
CoreSWHID
:
def
swhid_of_dir
(
path
:
bytes
,
exclude_patterns
:
Optional
[
Iterable
[
bytes
]]
=
None
)
->
CoreSWHID
:
obj
=
model_of_dir
(
path
,
exclude_patterns
)
obj
=
model_of_dir
(
path
,
exclude_patterns
)
return
obj
.
swhid
()
return
obj
.
swhid
()
...
...
This diff is collapsed.
Click to expand it.
swh/model/model.py
+
2
−
6
View file @
cd2b4090
...
@@ -59,10 +59,6 @@ Sha1Git = bytes
...
@@ -59,10 +59,6 @@ Sha1Git = bytes
Sha1
=
bytes
Sha1
=
bytes
KT
=
TypeVar
(
"
KT
"
)
VT
=
TypeVar
(
"
VT
"
)
def
hash_repr
(
h
:
bytes
)
->
str
:
def
hash_repr
(
h
:
bytes
)
->
str
:
if
h
is
None
:
if
h
is
None
:
return
"
None
"
return
"
None
"
...
@@ -71,8 +67,8 @@ def hash_repr(h: bytes) -> str:
...
@@ -71,8 +67,8 @@ def hash_repr(h: bytes) -> str:
def
freeze_optional_dict
(
def
freeze_optional_dict
(
d
:
Union
[
None
,
Dict
[
KT
,
VT
]
,
ImmutableDict
[
KT
,
VT
]]
# type: ignore
d
:
Union
[
None
,
Dict
,
ImmutableDict
]
)
->
Optional
[
ImmutableDict
[
KT
,
VT
]
]:
)
->
Optional
[
ImmutableDict
]:
if
isinstance
(
d
,
dict
):
if
isinstance
(
d
,
dict
):
return
ImmutableDict
(
d
)
return
ImmutableDict
(
d
)
else
:
else
:
...
...
This diff is collapsed.
Click to expand it.
tox.ini
+
1
−
1
View file @
cd2b4090
...
@@ -43,7 +43,7 @@ commands =
...
@@ -43,7 +43,7 @@ commands =
extras
=
extras
=
testing
testing
deps
=
deps
=
mypy
=
=
0.942
mypy
=
=
1.0
commands
=
commands
=
mypy
swh
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