Commit Graph

1204 Commits

Author SHA1 Message Date
Alexandr Evstigneev
1558ebcc44 Refactoring: ArrayList -> List and parameters annotations
GitOrigin-RevId: edb20461f7735a0c9e96574801bbeb60480686d3
2023-08-20 15:38:42 +00:00
Olga.Lavrichenko
b554080676 DS-5431 Column names are not at the top of the completion suggestions list in Jupyter notebook
Merge-request: IJ-MR-113147
Merged-by: Olga Lavrichenko <Olga.Lavrichenko@jetbrains.com>

GitOrigin-RevId: 777ade236fcbe9e596cc61cc20cce072f2d3ef97
2023-08-17 12:57:00 +00:00
Tagir Valeev
c37d3a2931 Warnings fixed
GitOrigin-RevId: 8a3bfbe6e9a14c6ef958ee978e120fb678001456
2023-08-17 11:16:39 +00:00
Mikhail Golubev
63d24cbb9d PY-34493 Enable back copying annotations from third-party .py files on Override/Implement
Since disabling turned out to be controversial. Even in the ticket some users were
against this decision claiming that it heavily annotated code bases it might be necessary
to retain all annotations from inherited method signatures. We need to think of a better
solution for controlling this behavior on case-to-case basis.

GitOrigin-RevId: c68763f0cad23de8975085e9bc8a6fd99013de3b
2023-08-09 20:53:35 +00:00
Mikhail Golubev
a2af264b63 PY-45588 Add necessary imports on completing methods of superclasses to override
I had to move addImports to PyClassRefactoringUtil because PySuperMethodCompletionContributor
resides in python-psi-impl and, thus, has no access to PyOverrideImplementUtil.

GitOrigin-RevId: cf2ac19da779977649144b2477bac3f8ae78bbcd
2023-08-09 20:53:35 +00:00
Mikhail Golubev
b50c617b7c PY-34493 Don't copy annotations from .pyi stubs and libraries on super method completion
GitOrigin-RevId: 65787827f5df5aa80986107dda0ba555b0942d40
2023-08-09 20:53:35 +00:00
Mikhail Golubev
dac1ef32bb [python] Re-use PyPsiRefactoringUtil.getAllSuperMethods in PySuperMethodCompletionContributor
GitOrigin-RevId: eee71055ad5caa0f3024a17b5cbab191991ac687
2023-08-09 20:53:35 +00:00
Mikhail Golubev
7c94813c3c [python] Simplify a check for duplicates in PySuperMethodCompletionContributor
GitOrigin-RevId: 47dcbc4f152b64c7c34f009d105336ad5d4b8155
2023-08-09 20:53:35 +00:00
Olga.Lavrichenko
0b85ca9bea DS-5427 Reformat break paths in IPython magic commands
GitOrigin-RevId: bfc5b6a9c473ac832b09ca723b41b22d7502b133
2023-08-07 17:11:24 +00:00
Vladimir Koshelev
7aeb74fe0a [PY-49040] add support for TypeGuards
Merge-request: IJ-MR-109904
Merged-by: Vladimir Koshelev <Vladimir.Koshelev@jetbrains.com>

GitOrigin-RevId: 8441ce35b2fc97fb0cdaf747feff2cf9ba3347ea
2023-08-02 22:27:54 +00:00
Mikhail Golubev
d9b71ea91e [python] Replace an ImmutableSet<IElementType> in PyConsoleParser with a TokenSet
GitOrigin-RevId: 6ddb10336ed83fecd476f613fac8e5b7f4fcd537
2023-08-02 16:32:18 +00:00
Sergey Karpov
c0842a6fde [pycharm] Squashed commits. PY-52478 Improve the names of quick fixes for "Unresolved references" and "Non-optimal list declaration"
(cherry picked from commit bce089714657aef8634ffb9c58da57fdb576b297)

IJ-CR-112218

GitOrigin-RevId: 8857c2951e44a1e9d0b54af1eb7c584f64fbc40d
2023-07-31 16:31:00 +00:00
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