You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Callable and a predicate object implementing the same behavior should be assignable to the same variable without mypy raising an error.
Are you reporting a bug, or opening a feature request?
bug
Please insert below the code you are checking with mypy,
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
You probably need to pre-declare file_filter (e.g., with file_filter: Callable[[Path], bool]). Mypy basically goes with the first assignment otherwise.
This is not a bug. matching_suffix is a narrower type than just Callable[[Path], bool] (for example you can access suffixes on it). You therefore need to either give an annotation or switch order of branches.
To clarify, this is an error from mypy's point of view:
A Callable and a predicate object implementing the same behavior should be assignable to the same variable without mypy raising an error.
Are you reporting a bug, or opening a feature request?
bug
Please insert below the code you are checking with mypy,
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
https://gist.github.com/Achimh3011/262acb8bf6d1b61ee7da6c574b662bd1
no error
yes
none
The text was updated successfully, but these errors were encountered: