The root cause was introduced in PY-23540 (see cb598c94c5).
Namely, abs.ABCMeta was explicitly filtered out from the list of metaclasses in
`PyClassImpl.getMostDerivedClassType` because for some reason in Typeshed stubs for
Python 2 `basestring`, and hence `str`, uses `ABCMeta` as its metaclass,
which is not true at runtime. It caused a metaclass conflict when inheriting `str`
with another user-defined metaclass (`ABCMeta` and a user metaclass didn't extend
each other), so we didn't detect any metaclass in a class as a result.
I've updated Typeshed stubs for Python 2 manually to process ABCMeta normally.
We don't update these stubs anyway, so these changes won't be lost on a future
Typeshed sync.
GitOrigin-RevId: 680e9fa890d00ea63987f3cf73e636e430685f34
See https://docs.python.org/3/reference/simple_stmts.html#the-raise-statement.
I decided not to update the inspection description, because BaseException is not
intended to be inherited by user classes.
The check for Exception was removed because Exception itself extends BaseException.
GitOrigin-RevId: 5782c9351aebb524c4d0fc0c9f3307d8db682efb
I've add-hoc updated typing_extensions.pyi in the bundled Typeshed to
recognize Unpack there.
GitOrigin-RevId: 953402e42984712a630c1772cf2f2cd4cbacdccf
Since pip [normalizes](https://github.com/pypa/packaging-problems/issues/230) underscores to dashes, PyCharm should treat them equally for requirements.txt entries
GitOrigin-RevId: 62149b9c64c67936f1405c7bf282a288e8d52764
These changes make PyStatementList elements (which are function and class bodies, cycle bodies, if-else branches, etc.) lazy-parseable which means they can now be reparsed without reparsing the whole file if changes are happened inside them accepted as safe
The main reason behind these changes is to improve performance
GitOrigin-RevId: 892acbe0c95fde6aec74b7595b0a58f902c426f5
Some remote interpreters have `sdk#homePath` starting with `ssh://`.
Code all over the monorepo assumes that `homePath` is a local file path and tries to convert it to `Path` throwing the exception effectively.
There is a `isCustomPythonSdkHomePath` which must be used to check string before trying to convert it into `Path`
The current situation (along with "solution") is a legacy from dark ages and will be rewritten to the workspace model soon
GitOrigin-RevId: 9adc02f312667571a65ff63d4e802aa7d6dbb518
In other words, in a statement like "await = 42" there are now both a warning about
the missing operand and a warning that an await expression cannot be used as
an assignment target. This behavior is consistent with other expressions where
additional parsing errors are not special-cased.
GitOrigin-RevId: 37a68eacc7ec042435c185f9ddd8bc2eea42b40f
Instead, parse them as usual and later report in the dedicated AssignTargetAnnotator
and TypeAnnotationTargetAnnotator. This way, a PsiError element appearing in the PSI
tree of a type declaration statement doesn't cause PyAstTypeDeclarationStatement.getTarget
nullability contract violation.
GitOrigin-RevId: a3e90088cfac7938c398d4d293a72dbd127a2cd0
Otherwise, incomplete stubs break our custom logic for resolving tensorflow
modules re-exported from its _api.v2 subpackage, such as tensorflow.audio,
tensorflow.image, tensorflow.random, etc.
We did the same for Numpy stubs in the past, enabling them back once they
became mature enough.
GitOrigin-RevId: b1e46067406a592761f56b7d296a287e5282b079
Use PyTypingTypeProvider.getAnnotationValue for that, similarly to already
re-used in other places PyTypingTypeProvider.getReturnTypeAnnotation.
Also, I've better separated handling of attributes explicitly annotated with Mapped
and just initialized with a mapped_column call. It will help to remove special
casing for Mapped once generic descriptors are fully supported in type inference
(PY-26184).
GitOrigin-RevId: eaeb66abd26b851507970b112360631704b41db3
Use withAlternativeResolveEnabled to prevent causing IndexNotReady exception.
Calling resolveQualifiedName as smartReadAction might be a bad idea
since it will postpone resolving for undefined period of time.
This method calls `foreignResults` which might access index as it does for Ultimate in `PyJavaImportResolver`
GitOrigin-RevId: 3bdbf103c3db4a9d55b5a72c3dfb3d5be9390cc4
Being a paid IDE, CLion users get the community version of Python plugin. In such configuration, successfully passing the condition `PlatformUtils.isCommercialEdition()` the further call of `PythonHelpersLocator.getHelpersProRoot()` method resulted in the assertions logged and a non-existent path of the Python Pro helpers returned.
GitOrigin-RevId: bca751f5524ad137f721af76c475905c54638177
The logic is similar to that for instance attributes. Top-level class
attributes and methods defined in the class body get the precedence,
followed by class attributes defined with assignments in @classmethods
unless the latter would resolve to the same assignments as in
cls.attr = cls.attr + 1
finally, we scan through all other class methods resolving the name
to the first definition inside one of them.
So far, I intentionally didn't expose such attributes in findClassAttribute()
or getClassAttributes() because users of these methods assume that
this API considers only attributes defined immediately in the class body.
Adding extra definitions from class methods might break these usages.
I had to update the inspection about typing.Final, because it relied
on the fact that resolve() on assignment targets on class objects can
lead only to those top-level class attributes, where type hints are normally
located, but now it can lead to assignments to a qualified attribute inside
a containing class method.
GitOrigin-RevId: 0ca5bdaa4efca127ac187e822a49df6795e1028a