Leaving current file boundaries to find a boolean value of a @dataclass
decorator argument breaks index locality and might lead to reentrant indexing,
e.g. when we access PySetuptoolsNamespaceIndex to determine if a directory
should be considered a package.
GitOrigin-RevId: e13ee0aec956e89ba69c600c29cd513ac5774762
This is a followup for DS-4508. The issue was caused by the fact
that intellij.python.helpers content is copied using NIO, and to make
it visible for VFS we need to perform refresh of the latter.
Without it, PyTypeShed.directory property cannot find the Typeshed
root and is initialized to null. Then, PythonSdkUpdater.buildSdkPaths
is unable to locate SDK-specific Typeshed roots and set the corresponding
interpreter paths on SDK update. The problem is that VFS refresh requires
a write action and PyTypeShed.directory is accessed under a read action
(e.g. via PyTypeShed.INSTANCE.isInside in PythonLanguageLevelPusher), so
performing an explicit refresh would cause a deadlock (not to mention
that copying files under a read action is generally concerning).
The easiest way to address that is just to resolve to these stubs directly
inside the distribution, as before, not triggering copying them. Such stub
files are not executable by the interpreter and, thus, don't cause the problems
with .pyc files corrupting the IDE installation, so it's safe to leave them
there.
For the time being, Typeshed and python-skeletons are still copied together
with executable helpers, though, but these copies are effectively ignored by
code analysis, It's only not to break the implicit contract of
PythonHelpersLocator.getHelpersRoot, from which it's expected that the entire
content of intellij.python.helpers would reside in the returned directory.
A proper solution would be to move all type hinting stubs from
intellij.python.helpers to a dedicated module, excluded from copying,
but it needs to be further discussed and is risky right before the release.
GitOrigin-RevId: 2470cc110faa8286c44be2102aacc48893ea7ea9
The rules for operators methods are the same as for regular
methods, exercised by other type checkers, i.e. it's assumed
that more specific overloads are defined earlier than less
specific. See e921654e47fe1fc5da047950b70775e342996757 for more
details.
Selecting compatible operator signatures also includes matching
"self" parameter against its expected type, which is necessary
for supporting typing.LiteralString, where some overloads of
"str" methods are made available only for literal strings.
Doing so, however, revealed a few issues with how we track
the direction of operator application, i.e. which operator
methods should be considered "reflected" and have swapped
receiver and argument. We rely on a method's name to decide
but the name is lost when a "reflected" method is defined through
an attribute assignment (PY-61093), and __eq__/__neq__ methods
are bidirectional so their names are not enough (PY-61090).
In PyUnresolvedReferencesInspectionTest.testStubAssignment we
matched C1.__mul__ and in PyTypeTest.testOperatorReturnsAny we
matched int.__eq__, despite the receiver and the argument being swapped,
because both of the methods are declared to accept Any value.
With more precise signature matching both of the tests now fail due to
the aforementioned issues. On the other hand, both of the cases seem rare,
so I disabled them for a while until there is a proper solution.
GitOrigin-RevId: 449a584ca258fe9210f5f2bda453caf9ab4faf7b
The deprecated `PythonHelpersLocator.getHelperPath` used to be cheap and had no I/O, but since bd5183320a43878de861fd11ae1f9bf79710290a it may start to copy many files to another directory. It becomes dangerous to call it from EDT.
GitOrigin-RevId: 98a913e68671b38299791fde7f267a396bd4faa0
Previously, methods PythonHelpersLocator.getHelpersRoot and PythonHelpersLocator.getHelpersProRoot were trivial and had no I/O inside. The things changed in bd5183320a43878de861fd11ae1f9bf79710290a, and it became dangerous to call potentially long operations within locks.
The helpers are used by Code Inside inspections, so it's impossible to move all executions of these functions out of read locks. So, the functions now checks the global progress indicator in order to hold read actions as little as possible.
Also, a logging message is added when calling these functions from EDT. It's not a hard assertion: code that used to work keeps working, but errors about threading are reported now.
GitOrigin-RevId: ae39a6ba6e91a01d2410ede859a0accfb312d758
Previously, PyCharm copied the parent of the helpers' directory. It contained python.jar which has size about 60 MiB and which is not used as a helper.
GitOrigin-RevId: d9cec6ddb93a36dc349af511fbb96221cdb5d951
Python helpers take more than 50 MiB, and copying it lazily on every startup can bring unnecessary performance problems on slow machines.
There's a better approach: copying the helpers into idea.system.path once per installation.
GitOrigin-RevId: 33bcf4eb61463d03480c985014d9e503f94638db
Previously, unresolved class attributes were not reported for the decorated classes because of potential dynamical attributes (see PY-7173). This commit enables this warning again because false-negative unresolved reference warning is much more common and distracting than the case with dynamic attributes
Merge-request: IJ-MR-105254
Merged-by: Daniil Kalinin <Daniil.Kalinin@jetbrains.com>
GitOrigin-RevId: 67d1ab3fe1d5a140836d49f8ef6a65cf01873456
The rename of the packages is needed to follow the naming convention. See the attached ticket for the details.
GitOrigin-RevId: 24b2328e572efa23d67133fc495855cf662ea795
Adds a new option which allows to parenthesise call chains, import statements, string literals and binary expressions instead of using backslashes when splitting them to multiline by pressing Enter
Tests for PY-17193, PY-10709
Merge-request: IJ-MR-98747
Merged-by: Daniil Kalinin <Daniil.Kalinin@jetbrains.com>
GitOrigin-RevId: 964f6c997e1e106a3d1b82d24e46947cc83fb2c6
Functions annotated with `NoReturn` and `Never` now taken into account in the Control Flow Graph building process, and the code after calling such functions is treated as unreachable.
Merge-request: IJ-MR-105973
Merged-by: Daniil Kalinin <Daniil.Kalinin@jetbrains.com>
GitOrigin-RevId: ef5840ae6e593498fc334dc9bd2daadccebf2b13
It is needed for `pytest` fixture function is not marked as one that can change the return type.
Now `pytest` fixture function returns `realType` instead of `Any | realType`.
See `PyKnownDecoratorUtil#asKnownDecorators`.
GitOrigin-RevId: c65334f2b15546f46ce5063be4c3952032bdb7c0
This reverts commit 08f87af551374373e8fd6b5e5133d4158c1e31de.
The commit 08f87af55 was de-facto a reversion of bab46cfcb44b86f2b6191b5c369f5170811eb98a.
During a private conversation it turned out that 08f87af55 was created mistakenly and unintentionally.
GitOrigin-RevId: ac8af8a3ee614f6afef2c10ab34bfc76b60edb7c
Add 'PyTestReferenceAsStringProvider' for fixtures from pytest.mark.usefixtures attributes.
Add new field 'myTextRange' to 'BaseReference' class.
It's needed for specify the text range for proper highlighting.
For example, to highlight text in a string without quotes.
GitOrigin-RevId: 5b9094169b71dd57d9091d6907346ca69f631ef3
It turns out that there are parts of code that suppose existence of all helpers without requesting them in advance via API of PythonHelpersLocator. These parts broke down when helpers became copied to a temporary directory.
Merge-request: IJ-MR-107692
Merged-by: Vladimir Lagunov <vladimir.lagunov@jetbrains.com>
GitOrigin-RevId: bab46cfcb44b86f2b6191b5c369f5170811eb98a
Add new intention and a corresponding quick fix for the usage pd.Series.values property from pandas library.
^DS-4878 Fixed
Merge-request: IJ-MR-106089
Merged-by: Natalia Murycheva <natalia.murycheva@jetbrains.com>
GitOrigin-RevId: 0c8dc40b09ee2d95ecd8ded532f31f5ef4a7740f