diff --git a/swh/model/cli.py b/swh/model/cli.py index 6508602110672049403ed507b5274549527d14dc..7fd99ed0a1c51407fae814786ff2deb6aed72537 100644 --- a/swh/model/cli.py +++ b/swh/model/cli.py @@ -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)) diff --git a/swh/model/collections.py b/swh/model/collections.py index 6de27eed61be03a9ce42858d3002e61243f3a5fc..35314ca06c3b925982fa0a544d6532d6f17d7a9e 100644 --- a/swh/model/collections.py +++ b/swh/model/collections.py @@ -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)) diff --git a/tox.ini b/tox.ini index 3728a15ae4ef7bcee2d26f9621ebeeb68f62f5bc..c6ba7d065a593c94a53fde20bb1b99afcbb17cab 100644 --- a/tox.ini +++ b/tox.ini @@ -48,7 +48,7 @@ commands = extras = testing deps = - mypy==1.0.1 + mypy>1.4 commands = mypy swh