Open tristanlatr opened 1 year ago
Here are a few of the problematic code fragments:
class _ScandirIterator(Iterator[DirEntry[AnyStr]], AbstractContextManager[_ScandirIterator[AnyStr]]):
...
_F = TypeVar("_F", bound=Callable[..., Any])
Callable = object
Any thoughts, @serge-sans-paille ?
Here is an implementation: https://github.com/serge-sans-paille/beniget/commit/9ff36a0c7931fd2150609158574fe176e896deaa and a test that includes checking whether the builtins.pyi stub is well processed: https://github.com/serge-sans-paille/beniget/commit/aee2834a54206fc4a34e63d775c79380f0b4e337
@serge-sans-paille could you please think whether you’d like to have this feature as part of beniget?
Here are the warnings that beniget reports (with PEP563 enabled) when parsing the typeshed builtins module and all its dependencies.
Most of them are because cyclic definitions of type aliases, or using a forward reference in a TypeVar bound argument.
We could introduce a new constructor flag that would signify whether we're inside a stub module and change a few behaviour regarding name resolution for a few specific scenarios.
Tell me what you think,