Commit Graph

1192 Commits

Author SHA1 Message Date
Olga.Lavrichenko
d4df46d5f0 DS-4478 Reformat code removes spaces in shell commands
GitOrigin-RevId: b06215e01de70329f3c9dfef4ea330ea73400cd2
2023-07-24 17:24:56 +00:00
Tagir Valeev
0d61f28ad5 [mod-commands] ModCommandAction#asQuickFix -> LocalQuickFix#from
GitOrigin-RevId: c8f2245707d267fe2412c2fd3da17bdb68557b20
2023-07-24 14:48:57 +00:00
Tagir Valeev
c0b3b031e7 [mod-commands] SetInspectionOptionFix -> UpdateInspectionOptionFix (ModCommand)
GitOrigin-RevId: a1916285a58398848a6ce3c477399b3a86370efc
2023-07-24 14:48:52 +00:00
andrey.matveev
213b82bde3 PY-54905 PY-54620 PY-61740 Fix goto declaration and implementation resolved pyi not py
PyDefinitionsSearch.java: replace psi element on original element if it is from pyi and then search for overrides, inheritors etc.

PyiUtil.java: recursively get original element while it is in stub (see the comment) and tests testGoToImplementationNameReExportedThroughAssignmentInPyiStub, testGoToImplementationNameReExportedThroughAssignmentInPyiStubTwice

PyUtil.java: make different methods turnDirIntoInitPy, turnDirIntoInitPyi instead of only turnDirIntoInit to handle cases when the same directory contains __init__.pyi and __init__.py files (PY-54620)

GitOrigin-RevId: 8f0d8a8133548e1a9f52f93b42aa9cae2302e8d7
2023-07-24 14:30:11 +00:00
andrey.matveev
272da294c3 PY-9045 Fix false positive cannot perform refactoring when execution flow is interrupted
Delete targets condition in createCodeFragment and filter duplicates

GitOrigin-RevId: 474f3634a06c9cff25bafc94e1651d4fe61fb2a0
2023-07-24 09:26:14 +00:00
Elena Shaverdova
8bc7f72301 Get rid of useless todos
GitOrigin-RevId: 4f085296e04040708209753f04654955e69c8072
2023-07-21 19:30:41 +00:00
Mikhail Golubev
e90b6b09b1 PY-53599 Declare only submodules available in qualified "tensorflow.xxx" imports
Modules re-exported as attributes are already covered by explicit declarations
for type checkers under "if _typing.TYPE_CHECKING:" in tensorflow/__init__.py
(see https://github.com/tensorflow/tensorflow/pull/54104). Only detached submodules
made available in imports through a module's __path__ manipulations should be
special-cased on our side.

GitOrigin-RevId: 5d5b732a18d06936dd6047150dfee3028f3fc0d4
2023-07-20 19:36:10 +00:00
Mikhail Golubev
2e809ff582 PY-53599 Add the post 2.6.0 Tensorflow module layout
In 2.6.0, keras became a standalone package re-exported in tensorflow.

GitOrigin-RevId: afbaea8bde1ddb078b15579eecf9fd2f1aef225e
2023-07-20 19:36:10 +00:00
Mikhail Golubev
d5ca67db75 PY-53599 Describe Tensorflow module layout in a more declarative fashion
GitOrigin-RevId: 74a0945ca44b0def76af11081f2783021d9765e8
2023-07-20 19:36:10 +00:00
Vladimir Lagunov
c0af49c7d4 Revert "DS-4508 Prevent importing python helpers from installation directory"
This reverts commit bd5183320a43878de861fd11ae1f9bf79710290a.

GitOrigin-RevId: 256fa99390462ccb08b1fbd742c863a25e82ae08
2023-07-19 11:26:55 +00:00
Vladimir Lagunov
bd15a164af Revert "DS-4508 PythonHelpersLocator: copy all helpers to the temporary directory"
This reverts commit bab46cfcb44b86f2b6191b5c369f5170811eb98a.

GitOrigin-RevId: 7adf8a29f9f136a2c20da07823fc40d8a7a70246
2023-07-19 11:26:53 +00:00
Vladimir Lagunov
7a1347720d Revert "PY-60971 Copy Python helpers not on every start"
This reverts commit 33bcf4eb61463d03480c985014d9e503f94638db.

GitOrigin-RevId: 5814b4bd42fbe3342fa2dc951a915873ce65db33
2023-07-19 11:26:52 +00:00
Vladimir Lagunov
2507600548 Revert "PY-60971 Reduce size of copied Python helpers"
This reverts commit d9cec6ddb93a36dc349af511fbb96221cdb5d951.

GitOrigin-RevId: 407dd2f34796d1e92bb05b51f9053819a13335e2
2023-07-19 11:26:51 +00:00
Vladimir Lagunov
ca1e970d0c Revert "PY-60971 Copy Python helpers within progress indicator"
This reverts commit ae39a6ba6e91a01d2410ede859a0accfb312d758.

GitOrigin-RevId: 4aefb4d74b11b2d83a104f44ea294b1ace04f6cc
2023-07-19 11:26:49 +00:00
Vladimir Lagunov
aa2bc116af Revert "PY-60971 Don't cache Python helpers in system path for snapshot builds"
This reverts commit d1413d1224c727d67904ebe3abbd67ebdac21a5d.

GitOrigin-RevId: cbaa50804b7d3ee829eb72b636f500251b1b2567
2023-07-19 11:26:48 +00:00
Vladimir Lagunov
7b2849be45 Revert "PY-60971 Create new API in PythonHelpersLocator that alerts about I/O"
This reverts commit 98a913e68671b38299791fde7f267a396bd4faa0.

GitOrigin-RevId: 9f2421c04de6892af26b8d8e2d023cce3f8bb420
2023-07-19 11:26:47 +00:00
Vladimir Lagunov
2d78be9fc6 Revert "PY-60738 Resolve to the bundled Typeshed and python-skeletons, ignore their copies"
This reverts commit 2470cc110faa8286c44be2102aacc48893ea7ea9.

GitOrigin-RevId: 8c8ca5ca567efeaa628b8fbf5c056e9f0f5fd907
2023-07-19 11:26:46 +00:00
Tagir Valeev
a2c5327a0d [model-branch] ModelBranch API mostly removed (IDEA-309887)
Only one use left inside Fleet; also something used in Kotlin library code

GitOrigin-RevId: a6d34b268fe286582bd4d68d0dec183aa30f93de
2023-07-14 22:49:39 +00:00
Mikhail Golubev
1a854fceb8 PY-55246 Enable back .pyi stubs bundled with numpy
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
2023-07-14 14:00:34 +00:00
Daniil Kalinin
2983980cbd PY-17193, PY-10709 enable Use parentheses instead of backslashes for breaking lines option by default
Change tests according to the new default value

GitOrigin-RevId: 79a09911127532fadcc4a4d37a454887d46effa9
2023-07-07 13:26:55 +00:00
Bernhard Geisberger
cdefaeb2ed FL-20443 Replace static initializer with lazy value to prevent ExceptionInInitializerError
GitOrigin-RevId: 7b7bc2d8d3382659a5fe2c8100d940dc7369a526
2023-07-07 12:09:24 +00:00
Mikhail Golubev
d22b8b00b9 [python] Extract a common quick fix for unresolved package problems
GitOrigin-RevId: a1db8823a2fc83424431d975e1820b415895cc7a
2023-07-06 10:41:32 +00:00
Vladimir Koshelev
989f378988 PY-27708 support type inference of elements for set and dict type comprehensions
Merge-request: IJ-MR-109862
Merged-by: Vladimir Koshelev <Vladimir.Koshelev@jetbrains.com>

GitOrigin-RevId: 5be72a4bafbbe7dc942a8bb9afeaded45d0ec896
2023-07-04 23:18:10 +00:00
Mikhail Golubev
ef75347111 [python] Don't perform resolve while building PSI stubs for dataclasses
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
2023-07-04 22:43:47 +00:00
Nikolay Chashnikov
eefdfd0421 [python] fix ReadAccessAllowed assertion in PySignatureCacheManagerImpl (EA-811329)
GitOrigin-RevId: 350eeeb5ffcf6b9e97d6818f9f46bad0e6ea4c26
2023-07-03 17:11:21 +00:00
lada.gagina
fb8f166314 [python] fix IOOBE in PyDictLiteralCompletionContributor (DS-5159)
GitOrigin-RevId: 7943a0ef0c28b365898af9c10b1cd1da4f26c462
2023-06-30 20:08:13 +00:00
Mikhail Golubev
a9a8ab00ef PY-60738 Resolve to the bundled Typeshed and python-skeletons, ignore their copies
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
2023-06-30 01:18:56 +00:00
Mikhail Golubev
58b27cca39 PY-61091 Select the most specific overload for binary operators
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
2023-06-21 16:32:22 +00:00
Lada Gagina
454b1287ae PY-58857 Infer typing.LiteralString for string literals
GitOrigin-RevId: 27507deabd61faedf7937415016f0f8334e5a418
2023-06-21 16:32:22 +00:00
Vladimir Lagunov
a277ed82d3 PY-60971 Create new API in PythonHelpersLocator that alerts about I/O
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
2023-06-21 10:35:21 +00:00
Vladimir Lagunov
c67b9317a0 PY-60971 Don't cache Python helpers in system path for snapshot builds
GitOrigin-RevId: d1413d1224c727d67904ebe3abbd67ebdac21a5d
2023-06-21 10:35:21 +00:00
Vladimir Lagunov
4fba990118 PY-60971 Copy Python helpers within progress indicator
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
2023-06-21 10:35:21 +00:00
Vladimir Lagunov
cc0a4820ca PY-60971 Reduce size of copied Python helpers
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
2023-06-21 10:35:21 +00:00
Vladimir Lagunov
9560dba2ec PY-60971 Copy Python helpers not on every start
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
2023-06-21 10:35:20 +00:00
Andrey.Matveev
070220ef3d [llm-pycharm] Impl isNameAlreadyUsed for python
GitOrigin-RevId: 280d59e11b6dcddccf1e806d5153a38ae1572e36
2023-06-20 10:44:50 +00:00
Mikhail Mazurkevich
61d59980f2 Revert "[Workspace Model] Migrate VersionedStorageChange to sequence instead of the list"
This reverts commit 0f6cdb7a.

GitOrigin-RevId: cfdc2a5bd56d291bf7f99256e9bcf279b1251c8c
2023-06-20 09:50:03 +00:00
Daniil Kalinin
157b23ce53 PY-33261 Inlay parameter hints for Python method and function calls
Merge-request: IJ-MR-108471
Merged-by: Daniil Kalinin <Daniil.Kalinin@jetbrains.com>

GitOrigin-RevId: 1d9451020a755c0aaf57c12b16829f8b31291e5d
2023-06-20 05:27:45 +00:00
Daniil Kalinin
eb2a834e65 PY-30190 Report unresolved class attributes in decorated classes
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
2023-06-20 04:39:38 +00:00
Alex Plate
15d01811d0 [Workspace Model] [IDEA-320676] Move several WorkspaceListener to the new module
GitOrigin-RevId: 11b538f3488b1fa1fd5501bc228c0516c4e384d3
2023-06-19 09:35:24 +00:00
Alex Plate
0ea27da5c6 [Workspace Model] [IDEA-320676] Move all packages from workspaceModel to workspace folder
GitOrigin-RevId: b70062397efd6347c34431c24aacd2ec2e216897
2023-06-19 09:35:12 +00:00
Alex Plate
acde44da72 [Workspace Model] [IDEA-320676] Rename jps module of workspace model
GitOrigin-RevId: 146fda1ce8b8e436eb48070e8cf96f2c654ea6a2
2023-06-19 09:35:11 +00:00
Alex Plate
e18c7d8a5f [Workspace Model] Move sources of the storage under workspace package
GitOrigin-RevId: 013ce64337fe7b3637d731c1093a2337bbe71f22
2023-06-19 09:35:08 +00:00
Alex Plate
bfd595ae86 [Workspace Model] [IDEA-320676] Rename package of jps model (ModuleEntity and other related entities)
GitOrigin-RevId: 102135a4f66c4a12c9b1f95035b1607cb933825d
2023-06-19 09:35:04 +00:00
Alex Plate
ae72bfb1d9 [Workspace Model] [IDEA-320676] Move ModuleEntity and friends to other module without changing the package
GitOrigin-RevId: 2f92e16012b84d5c4505c55a887df3623b460a0b
2023-06-19 09:35:02 +00:00
Alex Plate
37c54118b9 [Workspace Model] [IDEA-320676] Rename base packages of the workspace model: com.intellij.workspaceModel
The rename of the packages is needed to follow the naming convention. See the attached ticket for the details.

GitOrigin-RevId: 24b2328e572efa23d67133fc495855cf662ea795
2023-06-19 09:34:30 +00:00
lada.gagina
e768aa3785 PY-40996 Add ability to collapse and expand python type annotations
"Collapse/Expand Python Type Annotations" actions, an intention and a setting

GitOrigin-RevId: e055538b29b07c1836399f52754b786a15351050
2023-06-16 19:08:16 +00:00
Trinh Anh Ngoc
c9f0c216a0 [PY-56210] Add id for PyModuleNameCompletionContributor
Allow other contributors to take priority over it if needed

closes https://github.com/JetBrains/intellij-community/pull/2197

GitOrigin-RevId: 06e7378ddb47a57dc8e934afcadd7f0d1b88bbb7
2023-06-15 20:21:10 +00:00
Daniil Kalinin
d5de282edd PY-17193, PY-10709 Don't use \ for line continuation by default
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
2023-06-14 19:11:31 +00:00
Daniil Kalinin
45bb1fffb8 PY-24273, PY-53703 Support for functions annotated with typing.NoReturn and typing.Never
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
2023-06-13 22:08:30 +00:00
Egor.Eliseev
ca7085e665 PY-54839 Add _pytest.fixtures.fixture field to enum KnownDecorator
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
2023-06-13 13:59:31 +00:00