Commit Graph

5631 Commits

Author SHA1 Message Date
Andrey Lisin
c5b8178539 PY-45053 Disable tracing for new processes created with os.fork() when automatic attaching to subprocess is disabled
(cherry picked from commit 78b4b62d5992f775e54c59a81b065925467e6c31)

IDEA-CR-68169

GitOrigin-RevId: a1e4a9d2a42c62ba6629f1f91bbd17bcb27dfef5
2020-10-29 10:52:21 +00:00
Alexander Koshevoy
8e451c8adc PY-45231 Fix doubling up the path mapping when adding a new interpreter path with trailing slash
GitOrigin-RevId: 9eeca3e361991ecd6eb6808ea1a9fd4208f8d7ba
2020-10-29 08:48:43 +00:00
Mikhail Golubev
cf443d3061 PY-45115 Don't cache same directory import resolve results in Python 3
The cache of resolved qualified names is not context aware, so it's not safe to
keep such results in it. The legacy same directory imports in Python 2 have
already been taken into account and excluded, but we forgot to do the same for
recently enabled same directory imports in Python 3 project sources.

GitOrigin-RevId: f8885543ffa34ea652368a4f190210439173bdfc
2020-10-27 15:59:51 +00:00
Elizaveta Shashkova
37bd8db9a5 PY-45049 Types and parameters aren't shown in completion in Python Console
Revert support for descriptors in Python Console (PY-38151)

GitOrigin-RevId: 26af18ee282f490832c6d3722fc984079e8bd136
2020-10-23 13:39:09 +00:00
andrey.matveev
c5ae9550ce PY-42750 Allow same directory imports in Python 3 and introduce explicit namespace packages
There are 3 types of directories: plain directories, ordinary packages (with
__init__.py) and PEP 420 namespace packages. There are 3 types of imports:
absolute (from a root), same directory (absolute import from the current
directory when it's not explicitly marked as a root) and relative imports
(imports that start with dot).

Absolute imports are correct in all kinds of directories.
Same directory imports are correct in Python 2 in all cases and in Python 3 if
we have the directory containing the script with this import in Python path at
runtime. Users of Python 3 often face the problem when they can run the script
from the console because the directory containing this script got into Python
path but still have red underline and an unresolved reference error in the same
directory import because PyCharm didn't know that this file will be used as a
program's entry point. Previously, the way to fix such a problem was marking it
as a source root. But this action was not so obvious, especially for newcomers.
With this feature, such imports resolve successfully and now it is not necessary
to mark directories as source roots.

Relative imports are correct only in Python 3 namespace or ordinary packages and
should not be used in plain directories. If we have a relative import in plain
directory we highlight it with a weak warning and suggest 2 ways of fixing that:
marking directory as a namespace package explicitly (with quick fix or with Mark
As | Namespace Package) or changing this import to the same directory import
with a quickfix or manually.

Explicitly marking namespace packages can later be used for automatically
running files from them and ordinary packages with "-m".
The new resolve policy and explicit namespace packages can be disabled with the
Registry flag "python.explicit.namespace.packages".

These changes also address PY-40396. Namely, now any directory with __init__.py
inside or explicitly marked as a namespace package has a package icon,
regardless of its name or parents.

GitOrigin-RevId: 310fa562eb60121243cb6d68386ffc3e45c73245
2020-10-21 16:04:26 +00:00
KotlinIsland
1fdb8235e9 PY-44714 PyTypedDictInspection: don't register problem with None
Fix false positive with None as TypedDict value type
close #1452

GitOrigin-RevId: 7c02d8928f2e9ef3612aaf69d6daeb5a1b71cb95
2020-10-20 16:11:42 +00:00
Semyon Proshev
feed56de02 Sync with typeshed @ 10d3c6c325090172d5dc1cb99c5ce8a9319d88b2 (PY-41509, PY-41510, PY-44819)
Enable stubs for contextlib, cprofile, fractions, keyword, pipes, pkgutil, typed_ast, zoneinfo.
Skipped several `__init__` to `__new__` changes in builtin classes.

GitOrigin-RevId: dad913f67c69396d0db2d5e550254535713ea2f3
2020-10-19 21:15:33 +00:00
Mikhail Golubev
3bb3704165 Fix incorrect issue ID in PyStubsTest
GitOrigin-RevId: 52df37eb4addfcc5cedeaf1b03f742ac5338a94e
2020-10-19 19:46:56 +00:00
Mikhail Golubev
bb31fdc67d PY-42334 Add support for PEP 613 typing.TypeAlias
Both typing.TypeAlias (available only in 3.10) and typing_extensions.TypeAlias
names are supported.

RHS values of assignments annotated with TypeAlias are always retained in
stubs and injected into (if it's a string literal), regardless of whether
they look similar to a well-formed type hint. It seems natural to assume
that if a user employs such as specific marker as "TypeAlias" at all, they
clearly indicate that the value is supposed to be a type.

The inspections "Type hints definitions and usages" and "Final classes, methods
and variables" properly analyse RHS of assignments annotated with TypeAlias.
Type hinting inspection also reports illegal usages of TypeAlias, as it was
done for other special forms in the typing module.

The type of such variables themselves is Any, however they're still displayed
as having the type "TypeAlias" in Quick Documentation to avoid confusion.

GitOrigin-RevId: fab02f6e1060c0994e1d21201768e7b28ba7d9e0
2020-10-19 19:46:54 +00:00
Aleksei Kniazev
d18717b0ec PY-15046: fixed tests location
GitOrigin-RevId: 89137463dee2d6a3862b80c98e5a173639c1defe
2020-10-19 15:47:28 +00:00
Semyon Proshev
00eb505497 Python 2.6 is no more supported in compatibility inspection
Because 2.6 is not supported since 2019.1 in IDE.

GitOrigin-RevId: 3dee3e941c921ad3a5dc6d72cca840eb5d811691
2020-10-16 12:24:45 +00:00
Semyon Proshev
d30fc4f7bc Inline language level flags that are constants in supported python versions
GitOrigin-RevId: 5e381b72505c1d896028da83b7044be51e408f0b
2020-10-16 12:24:31 +00:00
andrey.matveev
a4a0f2fc60 IDEA-249489 Impl features for PyCharm DS
GitOrigin-RevId: dc1eeb1b5a7d0a63d70c57b39445d4c021059505
2020-10-09 08:38:08 +00:00
Semyon Proshev
b9281dd55f Mark python 3.5 as unsupported and update 3.9 modules list (PY-41512, PY-44853)
Modules list has been updated using python on Windows, seems it should be done on all OSes and merged.

GitOrigin-RevId: 621172608fffddc3e830f1133fba89a05d092eba
2020-10-08 14:37:43 +00:00
Ilya.Kazakevich
70fac8ef83 Replace VFSTestFrameworkListener with mock in tests
No need to do anything via timer in tests.
@Service annotation doesn't support interfaces

GitOrigin-RevId: 17d27699bc905959590823d4f54514d06cd37de0
2020-10-08 07:59:38 +00:00
Ilya.Kazakevich
30f5f725a9 Replace VFSTestFrameworkListener with mock in tests
No need to do anything via timer in tests.
@Service annotation doesn't support interfaces

GitOrigin-RevId: 27f660fe8c2bc2473657111d96ed93369f8f0751
2020-10-08 00:14:35 +00:00
Ilya.Kazakevich
e34f5806f4 Replace VFSTestFrameworkListener with mock in tests
No need to do anything via timer in tests.
@Service annotation doesn't support interfaces

GitOrigin-RevId: dcd63291564caf1ada93fe21cb4d4e5b9c03a59e
2020-10-08 00:03:29 +00:00
Ilya.Kazakevich
3ec677b8d9 Use packages only index in tests to make it a little bit faster
GitOrigin-RevId: eed56e1e59604ebb2ad6d079a1756aa679f411bf
2020-10-07 15:19:08 +00:00
Ilya.Kazakevich
ca5a32674c Use packages only index in tests to make it a little bit faster
GitOrigin-RevId: b0d344256b07dde1f1847e6a35b1732db0cf7152
2020-10-07 13:43:06 +00:00
Vladimir Lagunov
730944db22 IJ-CR-3234 Fix modality state.
GitOrigin-RevId: 9d62dbec9e20058a0dc9c6534e24034e03f75949
2020-10-07 10:43:07 +00:00
Ilya.Kazakevich
85ae3e8cb2 Move python debugger tests into the different folder.
Debugger tests are slow and fragile, so we move them into different config.

See .xml files in ``runConfigurations`` folder

GitOrigin-RevId: 0de6686314567c2028432a1071fddfd8fe69d0b8
2020-10-07 10:32:38 +00:00
Vladimir Lagunov
6ab9c591f6 IJ-CR-3234 Document the workaround for copyDirectoryToProject in the EDT in PyExecutionFixtureTestTask.
GitOrigin-RevId: c72849cd2c78c8c7fe028491588e8f915a051da1
2020-10-07 06:19:07 +00:00
Andrey Lisin
b7706f1aeb Activate dropping into debugger on failed test option before running unit tests
GitOrigin-RevId: 56cf0deb058de5dbb36a3394ce8999c546ec0d9a
2020-10-06 15:21:49 +00:00
Semyon Proshev
20a7eccfd8 Fix inferring type for cls in __new__ (PY-44470)
GitOrigin-RevId: b70a3d7111d70356ee27bddb337f401db0c49e1e
2020-09-30 19:17:51 +00:00
Vladimir Lagunov
d16d432555 Quick and dirty fix for hung Jupyter Env Tests.
GitOrigin-RevId: e5ce5325289dfb67ba4f6496688be9278dc58991
2020-09-30 07:15:28 +00:00
Mikhail Golubev
3f6bc5c1b9 PY-44586 Fix a typo in the test name and data: typing.overload, not override
GitOrigin-RevId: db691e2624a07a0e18bc987ef164230d5e7d0c8a
2020-09-25 20:03:57 +00:00
Semyon Proshev
92e044dcc0 Override call type of typing._SpecialForm.__get_item__ (PY-43838)
GitOrigin-RevId: 92e64b0aaea816d56eee85b2bc2417e184e0c4a1
2020-09-24 19:29:49 +00:00
Mikhail Golubev
ce48522d8f Make the test data layout of extended completion tests more uniform
GitOrigin-RevId: 5ca54fd7ba3446c0548c38d81051968dc7dc4586
2020-09-24 15:29:47 +00:00
Mikhail Golubev
3518c9339d PY-44586 Don't show duplicate completion variants for overrides and stubs
We shouldn't have used function's presentation there to check it's uniqueness,
it includes parameters that we rightfully don't include in the lookup string as
not affecting the import path anyhow.

GitOrigin-RevId: 29c5d231182afb5ebbf71787baea1cd292d82370
2020-09-24 15:29:46 +00:00
Vladimir Krivosheev
a67c59c561 platform.core.impl — remove dependency on intellij.platform.util.ui and intellij.platform.core.ui
java.psi.iml — remove dependency on intellij.platform.core.ui

GitOrigin-RevId: c1d4feb04c0471c7d17b5331b86738ee54a97f80
2020-09-21 13:40:47 +00:00
Mikhail Golubev
2d4cada4b3 PY-25832 Consider only class attributes for TypeVars wrapped in typing.Type
GitOrigin-RevId: 7cbdabfcbb5acad68e801c0c755a84acae7e8310
2020-09-18 11:47:26 +00:00
Mikhail Golubev
69aae259b1 PY-25832 Consider upper bound and constraints for completion and resolve on TypeVar
GitOrigin-RevId: c6b428965b0136f7f6051c992038dc15819b8f14
2020-09-18 11:47:26 +00:00
Roman Shevchenko
aef48d77c6 Cleanup (dropping unnecessary test-only method)
GitOrigin-RevId: af31d4cf7a1606e88866ebfd1ebfc97839033a3a
2020-09-17 11:37:58 +00:00
Semyon Proshev
30c56c3d7b Toggle reversed substitutions flag when matching callables parameters (PY-37876)
Since they are passed in the reversed order.

GitOrigin-RevId: 53643ef104e51d5ebac95ae8d29522530615db66
2020-09-16 19:20:37 +00:00
Semyon Proshev
1eb2bb981a Override call type of cls.__class_getitem__ (PY-43838)
GitOrigin-RevId: 530cbf657d2a76eae2b8dc11ea246be00ca74ee9
2020-09-16 18:52:24 +00:00
Mikhail Golubev
54563b5b5b PY-4311 Don't display method separators for nested functions and classes
I also changed the implementation so that only the very first tokens of
declarations are considered as anchors for method separators. Otherwise,
they start to flicker as their corresponding class and function elements
are often not re-evaluated by LineMarkerProviders on changes in a document.

GitOrigin-RevId: 90488c4bd1c662634c4b6681ce78b1b64c503782
2020-09-16 17:53:05 +00:00
Semyon Proshev
69ae32f06b Sync with typeshed @ d4191de79f5d65d5b8b6fecd68773f6d43a3c731 (PY-43297)
GitOrigin-RevId: 6510912ed00a94af5dc499bee2158ac17518baab
2020-09-16 14:58:32 +00:00
Mikhail Khorkov
a7668df48f PY-11858 Fix rename functon parameter along with decorator argument
If docorated function has a parameter and the decorator has
an argument with the same name as the parameter then we must not rename
the argument in case of renaming the parameter.

GitOrigin-RevId: ebc5dcf7448080e2762004a2779cd06700c042a8
2020-09-16 12:26:09 +00:00
Mikhail Golubev
8acf3cdbd1 PY-38315 Allow to convert quotes of empty string literals
GitOrigin-RevId: 8d601b3cd3e1f0440449e540da2b8edfef8440e6
2020-09-15 06:54:06 +00:00
Mikhail Golubev
9288bc605a PY-30798 Make the intention for converting string quotes work with f-strings
To avoid possible confusion regarding its target element, the intention is now
suggested only when the caret is inside a literal part of an f-string, not at
any expression it contains.

The conversion affects only the string on which the action was invoked,
including ones in its inner expressions, but not enclosing f-strings. Hence,
converting quotes for an f-string might also change quotes of its inner strings
to preserve the syntactic correctness. Converting quotes for an inner
strings, on the other hand, is possible only if it won't break their parent
f-strings.

GitOrigin-RevId: fb997ac8e26eea728897820f0d94bd84aa9e4491
2020-09-15 06:54:03 +00:00
Mikhail Golubev
7affe68244 PY-15608 Handle converting quotes on "glued" string literal with varying quotes
Namely, if such composed literal has nodes with different quotes, convert only
the one directly under the caret. This way we both preserve the old behavior,
when quotes of all individual strings of the literal were converted, and allow
to convert quotes of at least one element if that is not possible.

I've also migrated the intention to newer PyStringElement API that appeared with
the new f-string support.

GitOrigin-RevId: a8592a46e2991b172a205f041cbc3b668e242e8a
2020-09-15 06:54:01 +00:00
Alexey Kudravtsev
5d41e42767 cleanup: notnull and fix Processor type parameter types
GitOrigin-RevId: 694f1cf4f8b2602e5a0e199c92490e68ec303c1b
2020-09-14 13:46:01 +00:00
Aleksei Kniazev
5f8481db13 IDEA-CR-64748: fixes for namespace package resolve (PY-39748)
(cherry picked from commit c600a4b23556442cfcf7734dc212731017bc86a2)

GitOrigin-RevId: ac9d9b8c0a86f07533acbc4bba047a475581677b
2020-09-14 13:14:49 +00:00
Aleksei Kniazev
4d54941e2c IDEA-CR-64748: account for docstring when resolving namespace package, support try-except style declarations (PY-39748, PY-39512)
(cherry picked from commit 94907cff458e56607c11163bb681988a44750bc0)

GitOrigin-RevId: ff531a0b6f8fbf707656004d0e3ace38361e5cad
2020-09-14 13:14:47 +00:00
Elizaveta Shashkova
6bc321d78c Set correct sdk for Python Console tests
Signed-off-by: Elizaveta Shashkova <elizaveta.shashkova@jetbrains.com>

GitOrigin-RevId: 8c28d34b4a0cf82f09e9c4074ec27d28a7588e74
2020-09-13 13:54:23 +00:00
Elizaveta Shashkova
89d97681fa Make Python Console runner service available in tests
Signed-off-by: Elizaveta Shashkova <elizaveta.shashkova@jetbrains.com>

GitOrigin-RevId: 28fc533884a98b46867af9aae096d69e164dd9e9
2020-09-11 12:56:51 +00:00
Andrey Lisin
96eeaff135 Remove unused code
GitOrigin-RevId: 9f881350a56c819c7a545386594a8feb83f6440e
2020-09-11 07:12:30 +00:00
Andrey Lisin
9cba614023 Replace stream statement with ContainerUtil method
GitOrigin-RevId: 33efb4a8ba46b406dd839adde350c3d93177549b
2020-09-11 07:12:27 +00:00
Mikhail Golubev
efd3565bf8 PY-34873 Add a regression test for the problem
The issue itself was fixed, together with PY-32864, in
931d1ea4c09d145e763aed839dcb4acbb3e43ec7.

GitOrigin-RevId: af02861b24165da22722e2ad7891dc674a944472
2020-09-10 19:01:31 +00:00
Andrey Lisin
f22aef705f i18n: Mark hardcoded string in test as @NlsSafe
GitOrigin-RevId: 07482a74b4c07325f8402aef1dd80d343dd94dd8
2020-09-03 15:33:04 +00:00