Skip to content
Snippets Groups Projects
Commit 50d03102 authored by David Douard's avatar David Douard
Browse files

Fix annotations for mypy 1.4 (py37)

parent ad6a532a
No related branches found
No related tags found
1 merge request!340Migrate to copier-based template
Pipeline #5708 passed
......@@ -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))
......
......@@ -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))
......@@ -48,7 +48,7 @@ commands =
extras =
testing
deps =
mypy==1.0.1
mypy>1.4
commands =
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