Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
wesselb committed Jan 21, 2024
1 parent 8b65f89 commit 727e968
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plum/type.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def _is_hint(x):
return x.__module__ in {
"types", # E.g., `tuple[int]`
"typing",
"collections.abc", # E.g., `Callable`,
"collections.abc", # E.g., `Callable`
"typing_extensions",
}
except AttributeError:
Expand Down Expand Up @@ -222,8 +222,12 @@ def resolve_type_hint(x):
return resolve_type_hint(x.resolve())
else:
return x

# For example, `Is[lambda x: x > 0]` is an example of a `BeartypeValidator`. We
# shouldn't resolve those.
elif isinstance(x, BeartypeValidator):
return x

else:
warnings.warn(
f"Could not resolve the type hint of `{x}`. "
Expand Down

0 comments on commit 727e968

Please sign in to comment.