PyInterpreterInspection uses SDK configurators to find existing
environments and find the most suitable SDK. This operation takes time
(especially with conda on Windows), and on top it's performed on every
file change, making UI freeze all the time.
This change makes inspection asynchronous by caching the result and
triggerring inspection again to show changes on the UI.
Follow-up to IJ-MR-178613
GitOrigin-RevId: ed9e1aad89fb24ce70ba910ddd386a1adccd1baf
- support @dataclass(slots=True)
- add inspection for conflict with explicit __slots__
- add quickfix for new inspection
- add/adjust tests
GitOrigin-RevId: 5ac6efeb6c1e209b641365e2f22bdca74ae6484a
- moved functions to `PyTypeUtil`
- improved naming and documentation
- improved hitbox for unnecessary
- added tests to suites
Merge-request: IJ-MR-174646
Merged-by: Morgan Bartholomew <morgan.bartholomew@jetbrains.com>
GitOrigin-RevId: 4cecc6eb9a22cd8cc4d4019e0ff6f22faebe8cae
- adjust parser to support comma separated list of error classes
- add problem annotation and quick fix for missing parentheses
- add new tests, adjust old tests
GitOrigin-RevId: a1b9bdf252ac874aa7bd1a6881c1784259bb35cc
It also fixed problems with not reporting an error when a union
contained an incompatible class but didn't contain Any
(there was an unnecessary isWeak check) as well
as reporting false positives when a union contained special
members types for which we suppress attribute access warnings,
such as classes inheriting from Any or implicit protocols
(PyStructuralType).
Missing equals/hashCode needed to be added to PyStructuralType,
because otherwise PyUnresolvedReferencesInspectionTest.testUnionContainingUnknownType
started blinking due to unions sometimes containing duplicate structural types
(i.e. in some test runs `Union[{smth}, str]` was inferred and in others --
`Union[{smth}, str, {smth}]`).
GitOrigin-RevId: 63f720844c2892d2baa82be19b573221bd4f5d99
Under the registry flag "python.typing.strict.unions", enabled by default.
"Strict" union is considered a subtype of another type only if *all* its
members are subtypes of this type. Similarly, accessing an attribute on
a union type considered safe only if *all* its members contain this attribute.
It holds even if one of the union members is Any, i.e. "str | Any" is still
incompatible with "int", and it's not safe to access a non-str attribute on
it.
This is how all other type checkers treat union types. Historically, we
use so called "weak unions", where the above rules were relaxed so that
it was enough to have at least one compatible member type. It was
necessary because back then there was no way to declare function overloads,
type narrowing was limited (no pattern matching, no TypeIs/TypeGuard),
so proper strict unions, as in the type theory, would cause too many false
positives.
Co-authored-by: Aleksandr.Govenko <aleksandr.govenko@jetbrains.com>
GitOrigin-RevId: 8a676d810548bf71ac0ff3497e59d8694e03e4db
Similar to PyRedeclarationInspection but specifically for type aliases.
The difference is that for type aliases, we should report them as redelclarations even if they were used before
GitOrigin-RevId: 735c7be53bf7625cf0dccb83d8a3157665f65a96
It also caused double highlighting on the frontend as PyKeywordHighlightingAnnotator is currently registered in both frontend and backend.
GitOrigin-RevId: cdf111acfdb8a979613007e12abcf6c7dac9c9dd
A class containing at least one method declared with `abstractmethod` decorator that hasn’t been overridden yet cannot be instantiated.
Also report instantiation of classes that directly inherit ABC or have metaclass set to ABCMeta.
GitOrigin-RevId: 55cb4dc90c55ddc63991a4c3f6b50b4e34a3b4bd
Using generic classes (parameterized or not) to access attributes will result in type check failure.
GitOrigin-RevId: a4c8c419dd46aaab9a66cf42391821d9035c5dba
* Ensure 'Concatenate' is only allowed as the first argument to 'Callable' in type hints.
* Added a test
* Exclude 'generics_paramspec_basic.py' from ignored as it passes now
GitOrigin-RevId: f44af8fc1426ce7b6d7f725b4a72270bc8015d0f