Skip to content

Commit e17ddaf

Browse files
committed
fix: improments on type hints
1 parent 160ee86 commit e17ddaf

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/joserfc/_rfc7516/json.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
GeneralJSONSerialization,
1313
FlattenedJSONSerialization,
1414
)
15-
from ..registry import Header
1615
from ..util import (
1716
to_bytes,
1817
to_str,
@@ -33,7 +32,7 @@
3332

3433

3534
def represent_general_json(obj: GeneralJSONEncryption) -> GeneralJSONSerialization:
36-
data = __represent_json_serialization(obj)
35+
data: GeneralJSONSerialization = __represent_json_serialization(obj)
3736
recipients = []
3837
for recipient in obj.recipients:
3938
item: JSONRecipientDict = {}
@@ -43,22 +42,22 @@ def represent_general_json(obj: GeneralJSONEncryption) -> GeneralJSONSerializati
4342
item["encrypted_key"] = to_str(urlsafe_b64encode(recipient.encrypted_key))
4443
recipients.append(item)
4544
data["recipients"] = recipients
46-
return data # type: ignore[no-any-return]
45+
return data
4746

4847

4948
def represent_flattened_json(obj: FlattenedJSONEncryption) -> FlattenedJSONSerialization:
50-
data = __represent_json_serialization(obj)
49+
data: FlattenedJSONSerialization = __represent_json_serialization(obj)
5150
recipient = obj.recipients[0]
5251
assert recipient is not None
5352
if recipient.header:
5453
data["header"] = recipient.header
5554
if recipient.encrypted_key:
5655
data["encrypted_key"] = to_str(urlsafe_b64encode(recipient.encrypted_key))
57-
return data # type: ignore[no-any-return]
56+
return data
5857

5958

60-
def __represent_json_serialization(obj: BaseJSONEncryption): # type: ignore[no-untyped-def]
61-
data: dict[str, t.Union[str, Header, list[Header]]] = {
59+
def __represent_json_serialization(obj: BaseJSONEncryption) -> t.Any:
60+
data: dict[str, t.Any] = {
6261
"protected": to_str(json_b64encode(obj.protected)),
6362
"iv": to_str(obj.base64_segments["iv"]),
6463
"ciphertext": to_str(obj.base64_segments["ciphertext"]),

0 commit comments

Comments
 (0)