Skip to content

Commit

Permalink
Use contextlib.suppress instead of try-except
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirVondukr committed May 9, 2024
1 parent 96d247d commit 6a39e81
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions aioinject/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,12 @@ def get_return_annotation(
globalns: Namespace | None,
localns: Namespace | None,
) -> Any | None:
try:
with contextlib.suppress(NameError):
return typing.get_type_hints(
obj,
globalns=globalns,
localns=localns,
).get("return")
except NameError:
pass

return_type = obj.__annotations__.get("return")
if return_type is None:
Expand Down

0 comments on commit 6a39e81

Please sign in to comment.