Skip to content

Commit 716cde7

Browse files
jkuLukas Puehringer
authored andcommitted
lint: Remove unneeded noqa flags
Re-raising a blind exception is now ok. Signed-off-by: Jussi Kukkonen <[email protected]>
1 parent 96d406c commit 716cde7

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

tuf/api/dsse.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def from_bytes(cls, data: bytes) -> "SimpleEnvelope[T]":
7676
envelope_dict = json.loads(data.decode())
7777
envelope = SimpleEnvelope.from_dict(envelope_dict)
7878

79-
except Exception as e: # noqa: BLE001
79+
except Exception as e:
8080
raise DeserializationError from e
8181

8282
return envelope
@@ -96,7 +96,7 @@ def to_bytes(self) -> bytes:
9696
envelope_dict = self.to_dict()
9797
json_bytes = json.dumps(envelope_dict).encode()
9898

99-
except Exception as e: # noqa: BLE001
99+
except Exception as e:
100100
raise SerializationError from e
101101

102102
return json_bytes
@@ -116,7 +116,7 @@ def from_signed(cls, signed: T) -> "SimpleEnvelope[T]":
116116
signed_dict = signed.to_dict()
117117
json_bytes = json.dumps(signed_dict).encode()
118118

119-
except Exception as e: # noqa: BLE001
119+
except Exception as e:
120120
raise SerializationError from e
121121

122122
return cls(json_bytes, cls._DEFAULT_PAYLOAD_TYPE, {})
@@ -145,7 +145,7 @@ def get_signed(self) -> T:
145145
else:
146146
raise ValueError(f'unrecognized role type "{_type}"')
147147

148-
except Exception as e: # noqa: BLE001
148+
except Exception as e:
149149
raise DeserializationError from e
150150

151151
return cast(T, inner_cls.from_dict(payload_dict))

tuf/api/metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ def sign(
375375

376376
try:
377377
signature = signer.sign(bytes_data)
378-
except Exception as e: # noqa: BLE001
378+
except Exception as e:
379379
raise UnsignedMetadataError(f"Failed to sign: {e}") from e
380380

381381
if not append:

tuf/api/serialization/json.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def deserialize(self, raw_data: bytes) -> Metadata:
3535
json_dict = json.loads(raw_data.decode("utf-8"))
3636
metadata_obj = Metadata.from_dict(json_dict)
3737

38-
except Exception as e: # noqa: BLE001
38+
except Exception as e:
3939
raise DeserializationError("Failed to deserialize JSON") from e
4040

4141
return metadata_obj
@@ -77,10 +77,10 @@ def serialize(self, metadata_obj: Metadata) -> bytes:
7777
raise ValueError(
7878
"Metadata changes if you serialize and deserialize."
7979
)
80-
except Exception as e: # noqa: BLE001
80+
except Exception as e:
8181
raise ValueError("Metadata cannot be validated!") from e
8282

83-
except Exception as e: # noqa: BLE001
83+
except Exception as e:
8484
raise SerializationError("Failed to serialize JSON") from e
8585

8686
return json_bytes
@@ -97,7 +97,7 @@ def serialize(self, signed_obj: Signed) -> bytes:
9797
signed_dict = signed_obj.to_dict()
9898
canonical_bytes = encode_canonical(signed_dict).encode("utf-8")
9999

100-
except Exception as e: # noqa: BLE001
100+
except Exception as e:
101101
raise SerializationError from e
102102

103103
return canonical_bytes

tuf/ngclient/fetcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def fetch(self, url: str) -> Iterator[bytes]:
6868
return self._fetch(url)
6969
except exceptions.DownloadError as e:
7070
raise e
71-
except Exception as e: # noqa: BLE001
71+
except Exception as e:
7272
raise exceptions.DownloadError(f"Failed to download {url}") from e
7373

7474
@contextmanager

0 commit comments

Comments
 (0)