-
Notifications
You must be signed in to change notification settings - Fork 139
Open
Labels
help wantedContributions especially welcomeContributions especially welcomenarrowingrelated to flow-sensitive type narrowingrelated to flow-sensitive type narrowingtyping semanticstyping-module features, spec compliance, etctyping-module features, spec compliance, etc
Milestone
Description
Add support for narrowing on TypeGuard and TypeIs:
-
TypeIshttps://github.com/astral-sh/ruff/labels/help%20wanted -
TypeGuard
This will in turn support builtins.callable:
Add support for narrowing on builtins.callable, requires TypeIs support.
builtins.pyi:
def callable(obj: object, /) -> TypeIs[Callable[..., object]]: ...Otherwise, it causes a few false positives, like:
def _(a: Any | None) -> None:
# /private/tmp/mypy_primer/projects/bidict/bidict/_iter.py:50:34: Object of type `None` is not callable
if callable(a):
a() # red-knot: Object of type `None` is not callable [lint:call-non-callable]
reveal_type(a) # revealed_type: Any | NoneAvasam and ZuidVolt
Metadata
Metadata
Assignees
Labels
help wantedContributions especially welcomeContributions especially welcomenarrowingrelated to flow-sensitive type narrowingrelated to flow-sensitive type narrowingtyping semanticstyping-module features, spec compliance, etctyping-module features, spec compliance, etc