Skip to content
Snippets Groups Projects
Commit cd2b4090 authored by Antoine Lambert's avatar Antoine Lambert
Browse files

mypy: Bump to 1.0 and fix new typing errors

Related to swh/meta#4960
parent 6375f8e9
No related branches found
Tags v6.6.3
No related merge requests found
...@@ -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()
......
...@@ -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:
......
...@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment