diff --git a/swh/model/from_disk.py b/swh/model/from_disk.py index 798851a23514c85a44cca0dd6c816153c6ae7485..bd6308ec74482a482452aea388a65053c84a0573 100644 --- a/swh/model/from_disk.py +++ b/swh/model/from_disk.py @@ -567,7 +567,6 @@ class Directory(MerkleNode): """Builds a `model.Directory` object based on this node; ignoring its children.""" if self.__model_object is None: - DirectoryEntry = model.DirectoryEntry entries = [] diff --git a/swh/model/hypothesis_strategies.py b/swh/model/hypothesis_strategies.py index 45671861f8c8a6f1215bc1fc758505d9b7722845..8beca3427c8d79bda322f4711b4ed896c97f0b2d 100644 --- a/swh/model/hypothesis_strategies.py +++ b/swh/model/hypothesis_strategies.py @@ -479,7 +479,7 @@ def snapshots_d(draw, *, min_size=0, max_size=100, only_objects=False): } ) except ValueError as e: - for (source, target) in e.args[1]: + for source, target in e.args[1]: branches[source] = draw(branch_targets_d(only_objects=True)) else: break diff --git a/swh/model/model.py b/swh/model/model.py index 0170bcaf350579c995f3f39ea36fe7ad55dd9f56..c1a6481fdb7ec3a58a9fca1d4c47991ce95bc562 100644 --- a/swh/model/model.py +++ b/swh/model/model.py @@ -229,7 +229,7 @@ def _immutable_dict_validator( key_validator = optimized_validator(expected_key_type) value_validator = optimized_validator(expected_value_type) - for (item_key, item_value) in value.items(): + for item_key, item_value in value.items(): key_validator( instance, attribute, @@ -282,7 +282,7 @@ def optimized_validator(type_): ): if origin_value is None: origin_value = value - for (validator, type_) in all_validators: + for validator, type_ in all_validators: try: validator( instance, diff --git a/swh/model/tests/test_hashutil.py b/swh/model/tests/test_hashutil.py index b279f2fa9d15bf85ab2ffa8a32deefc27545332a..3153ef0428e3345d147700541fb7d100cd6d6cf7 100644 --- a/swh/model/tests/test_hashutil.py +++ b/swh/model/tests/test_hashutil.py @@ -36,7 +36,6 @@ def blake2_hash_cache_reset(): @pytest.fixture def hash_test_data(): class HashTestData: - data = b"1984\n" hex_checksums = { "sha1": "62be35bf00ff0c624f4a621e2ea5595a049e0731", diff --git a/swh/model/tests/test_hypothesis_strategies.py b/swh/model/tests/test_hypothesis_strategies.py index 1531ff506f023d2b8ff854a4f26d3298bb29cce0..e43f3127c8c7bc50c626f6155085ed0cf23d7033 100644 --- a/swh/model/tests/test_hypothesis_strategies.py +++ b/swh/model/tests/test_hypothesis_strategies.py @@ -63,7 +63,7 @@ def assert_nested_dict(obj): """Tests the object is a nested dict and contains no more class from swh.model.model.""" if isinstance(obj, dict): - for (key, value) in obj.items(): + for key, value in obj.items(): assert isinstance(key, (str, bytes)), key assert_nested_dict(value) elif isinstance(obj, tuple): @@ -164,7 +164,6 @@ _max_snp_size = 100 @given(snapshots(min_size=_min_snp_size, max_size=_max_snp_size)) @settings(max_examples=1) def test_snapshots_strategy(snapshot): - branches = snapshot.branches assert len(branches) >= _min_snp_size diff --git a/swh/model/tests/test_model.py b/swh/model/tests/test_model.py index 248410f99fcbce422207294493b9993c11a2106e..e6182ee326bf2a92381dffe8420d0a282180aadf 100644 --- a/swh/model/tests/test_model.py +++ b/swh/model/tests/test_model.py @@ -769,7 +769,7 @@ def test_person_comparison(): def test_content_get_hash(): hashes = dict(sha1=b"foo", sha1_git=b"bar", sha256=b"baz", blake2s256=b"qux") c = Content(length=42, status="visible", **hashes) - for (hash_name, hash_) in hashes.items(): + for hash_name, hash_ in hashes.items(): assert c.get_hash(hash_name) == hash_ @@ -1225,7 +1225,6 @@ def test_revision_check(revision): @given(strategies.revisions(raw_manifest=none())) def test_revision_raw_manifest(revision): - raw_manifest = b"foo" id_ = hashlib.new("sha1", raw_manifest).digest() diff --git a/swh/model/tests/test_swhids.py b/swh/model/tests/test_swhids.py index 5c3cab22ee2cbeab65958ee230562dfab1ed3d58..12a46a010b39465bccabd48390e286d2c64b52db 100644 --- a/swh/model/tests/test_swhids.py +++ b/swh/model/tests/test_swhids.py @@ -230,7 +230,7 @@ VALID_SWHIDS = [ def test_parse_unparse_swhids(string, core, qualified, extended): """Tests parsing and serializing valid SWHIDs with the various SWHID classes.""" classes = [CoreSWHID, QualifiedSWHID, ExtendedSWHID] - for (cls, parsed_swhid) in zip(classes, [core, qualified, extended]): + for cls, parsed_swhid in zip(classes, [core, qualified, extended]): if parsed_swhid is None: # This class should not accept this SWHID with pytest.raises(ValidationError) as excinfo: