8 Commits
Author SHA1 Message Date
Mikhail Golubev 820da7c49c PY-77940 Allow resolving underscored names in .pyi stubs
This reverts the changes made in eb733982acf0992fbae822d0feb582fb07ad010f
for PY-40233.

The original problem was PyShadowingBuiltinsInspection erroneously reporting
redefining private names declared in builtins.pyi, such as _T, however,
resolving underscored names from all .pyi stubs was prohibited to fix that.

These are considered "stub-only objects" according to the typing spec
(https://typing.readthedocs.io/en/latest/guides/writing_stubs.html#stub-only-objects),
but it doesn't prohibit reusing them in other stubs and in .py files under
an `if typing.TYPE_CHECKING:` guard.
Besides, both Mypy and Pyright resolve such names imported from .pyi stubs without warnings,
so it doesn't make sense to enforce additional visibility restrictions from our side.

Also, I enabled completing such names in other .pyi stubs (but not in .py files).
Previously, in PY-38172 their completion was disabled everywhere.

GitOrigin-RevId: 8340d4dcaf732d18d481bbee824ffdddd2719d3d
2024-12-18 16:55:26 +00:00
Mikhail Golubev 226fb9c27c Restore canonical import paths inside .pyi stubs
Previously, we looked only for __init__.py to detect re-exported names,
ignoring __init__.pyi that could be used for the same purpose in stub
packages.

GitOrigin-RevId: 48bc58789e47d5b9fb814b99722371fdd670ee2d
2020-12-04 15:49:35 +00:00
Semyon Proshev 83a321b609 Remove dead code that resolves forward references in annotations 2018-03-13 17:36:51 +03:00
Andrey Vlasovskikh 9382795263 PY-21231 Resolve to Python stub even if target is present in Python file 2017-02-02 01:22:47 +03:00
Andrey Vlasovskikh 60fdbc241d Resolve module attributes in Python stub files (PY-16402) 2015-07-13 14:19:05 +03:00
Andrey Vlasovskikh 69b0243b5d Added a test for resolving from a Python *.pyi stub to a Python file (PY-16402) 2015-07-08 14:41:21 +03:00
Andrey Vlasovskikh 2df926971f Added a test for resolving builtins in *.pyi (PY-15206) 2015-07-08 01:28:32 +03:00
Andrey Vlasovskikh de7a0d6143 Resolve references inside *.pyi files (PY-15206) 2015-07-08 01:17:53 +03:00