Inspection covers such cases:
* Extending typing.Generic in new-style generic classes
* Extending parameterized typing.Protocol in new-style generic classes
* Using generic upper bounds and constraints with type parameters for ParamSpec and TypeVarTuple
* Mixing traditional and new-style type variables
* Using traditional type variables in new-style type aliases
GitOrigin-RevId: 8812959f64d2d87e1b72f713405edb86936220b9
We turned them off as part of PY-48166. Now these stubs are much more complete
and fix a number of problems with the code insight for the library (PY-35164,
PY-37461, PY-50394, PY-59347, PY-60224), most of which are caused by the lack
of information in skeletons automatically generated for its binary modules or
incorrect type information being extracted from docstrings.
I leave the possibility to disable the stubs for the time being and will remove
the registry option once it become clear that they don't cause serious problems.
GitOrigin-RevId: 0df09ddb8ca40f88b908e19c0f49f5b005abaa58
Precise types can be inferred only over AST if it's accessible.
I had to move PyStdlibTypeProvider higher in the provider's hierarchy
so that it could override types coming from Typeshed, otherwise we
infer enum.property type for the "value" attribute.
GitOrigin-RevId: 8727e080cfc06d0edda13eccfd601601dc661da9
* Dedicated inspections for `ClassVar` variables in variable declarations, variable reassignments, function parameters, local and return variables
* Types of `ClassVar` variables now resolves correctly
* Tests for `ClassVar` inspections
GitOrigin-RevId: 0fd0ef0126ba2c2801ef82bcbeca4ea9b0c48c73
By running the completion contributor for non-imported modules after everything
else, including the LegacyCompletionContributor offering names present in
the scope, and filtering out duplicate variants.
GitOrigin-RevId: 98982b2c33d1fc11d70b144de556a6825bd3febc
this makes accessing decorator arguments possible without needing to parse the file again
(cherry picked from commit a9854dbf181f3c7bf488d6ecc18205bb29df2422)
IJ-MR-15304
GitOrigin-RevId: 1031d888a4a08a706c4fa9e2dc48e2f97462c95e
Both are implemented other the type of the corresponding class.
References resolve to any readable attribute of a class, however
some obviously wrong variants such as special "dunder" attributes
and methods are intentionally excluded from completion suggestions.
GitOrigin-RevId: 5edac14f47cba39840b15b0dd7f21e2e46077261
PyDocstring is based on Python, but its custom tokens `>>>` and `...` are registered just as whitespace. These tokens are ignored by the Python code formatter, which results in exceptions from the formatting model, which doesn't cover the whole text range.
We could either fix the formatting model or just disable formatting for PyDocstring. I prefer the latter for now, since the current approach with PyDocstring being a dialect of Python results in many subtle errors. It's better to have a workaround for now and maybe re-write doctest support later.
GitOrigin-RevId: 68b9a57650631f5d7245c85ada294af85c0aad44
It includes several impovements over the existing implementation:
* Full qualifier it considered instead of just its last component, e.g. "foo.bar"
for "foo.bar.Baz<caret>", not just "bar".
* These results are not suggested for references that are themselves qualifiers for
other attributes, e.g. in "foo.ba<caret>r.Baz()".
* Completion is automatically restarted as soon as attribute prefix appears, i.e.
as soon as any extra character is typed in "foo.<caret>".
* Completion uses an apropriate scope, excluding stdlib's tests
* New variants are added incrementally and respecting PCE, not in a batch, to improve
responsiveness
GitOrigin-RevId: d6a84bf3a2096e60fca87794da6ed5836c5b9244
The new stub-based index maps names of all "public" top-level definitions
to the corresponding PSI elements. Fully qualified names are matched by
both definition's short name and an already typed reference qualifier, i.e.
"foo.bar.MyClass" matches "foo.My" and "bar.My" but not "foo.bar". Qualified
names are initially restored directly from VFS without any normalization or
canonization to improve performance, but then properly canonized before
displaying them among completion suggestions.
GitOrigin-RevId: 768ef6d51e535e8102fca0693c7a51db400fc783
Now we can infer decorated method's type based on the type or
type hints of their decorators. It is possible to use several
decorators on the method.
GitOrigin-RevId: 22f934ab5be9cb49a4ae65cbd72e17a7d1505778
Now we can export Cython and Python functions with type
annotations from .pyx files to both .pyx and .py files.
Also we can make type matching in Cython files.
Type checker only support numeric types for now.
GitOrigin-RevId: a7af4264285cc14e09991545998609fbd24432e5
Callee is now a receiver for these cases, previously it was `null`.
Callee is not replaced with constructors to have an ability to map it onto self/cls parameters and process `(cls: Type[T], ...) -> T` annotations.
Stay with the previous behaviour for navigation and looking for target element.
GitOrigin-RevId: c0f9894cf50fd5d7fd325f095976d096fb948e89
Some inspection had duplicated messages for their names. Normalized those
to use "INSP.NAME" keys for that purpose and removed unused copies.
Also, one of the messages was used only in a test commented ten years ago.
Got rid of that and the corresponding test data.
GitOrigin-RevId: c859370a8b62079e9e345cd03386da850de28586
Get rid of PyNamedTupleType.DefinitionLevel (finally) and PyOverridingTypeProvider.
PyNamedTupleType is updated here since otherwise we would have to provide parameters for PyNamedTupleType with NT_FUNCTION as a definition level via PyNamedTupleType.getParameters.
Update NumpyDocStringTypeProvider and numpy test data, otherwise it will return `numpy.core.ufunc` as a type for every function having special name.
See NumpyDocStringTypeProvider.getReferenceType.
Return accidentally lost behaviour in PyiUtil.findSimilarElement for classes: don't look for similar element in ancestors.
GitOrigin-RevId: e2410eaa0e0cd5f98e4a86515b4358c140b373e6