Commit Graph

3972 Commits

Author SHA1 Message Date
Mikhail Golubev
c955ffbcc7 PY-39682 Handle union types of qualifiers when deducing FQN for unresolved attributes
The underlying problem is that we started to infer a confusing union type
of __init__.py modules found both in site-packages and python_stubs
for such imported packages, but I want it to be addressed separately in PY-39911.

GitOrigin-RevId: 053a4a092ce7fcc71d192dbaa6b1623b82472a17
2020-01-16 08:11:51 +00:00
Semyon Proshev
bbaead5046 Skip empty classes while inspecting fields order (incl inherited) (PY-40018)
GitOrigin-RevId: 53ce68c45df4049346c67416d250b2e36e2c762c
2020-01-10 13:09:02 +00:00
Semyon Proshev
f7a9d32840 Better warning message instead of Name 'variable' can be not defined (PY-39866)
GitOrigin-RevId: 68ab0989afd535a0f0958028290a021a21794663
2019-12-31 12:33:54 +00:00
Lada Gagina
16be4d1594 IDEA-CR-56349: PY-39404 PY-39594 Fix type inference for TypedDict types
* For cases when a TypedDict was defined in a separate file
* Fix race when typing near inherited TypedDict's field

GitOrigin-RevId: e19792592c744e9c5a7a7c00af847296efb11d0c
2019-12-27 10:34:55 +00:00
andrey.matveev
d66e0eec0e PY-10184 Impl hasattr support
GitOrigin-RevId: e5826372ddfe233656097da774d978c57ee54937
2019-12-23 13:08:30 +00:00
Ilya.Kazakevich
6feb35abfb tests for unittest2 removed (not used anymore)
GitOrigin-RevId: 91bb6d580e7527ab69216f1ae4143be065d5bbc2
2019-12-11 13:38:19 +00:00
Semyon Proshev
6144d481b8 Update resolving qname in scope so functions are processed correctly (PY-35881)
GitOrigin-RevId: 4949f39dbe340d51e8ffd990c3a02b06d52adf2d
2019-12-11 13:12:09 +00:00
Elizaveta Shashkova
5c67bc0373 IDEA-CR-56419: PY-34555 Clean module flag for child process
If a process was started with `-m` key (and converted to `--module` flag), this parameter will be passed to all its child processes. So we need to clear this flag in SetupHolder before patching arguments

GitOrigin-RevId: 00ae0b23fc6107bee75272a03a5bd15ca474fbc7
2019-12-10 15:38:42 +00:00
Mikhail Khorkov
9b3dc939a3 PY-7251 Fix unresolved reference severity in import statements
Unresolved reference need to be error highlighted because
module is something certain and unresolved import is error in most cases.

GitOrigin-RevId: b91e54e695b908db193a35378e663288dae90059
2019-12-06 10:07:44 +00:00
Semyon Proshev
2cff147ca9 Provide callable type for resolved dataclasses.replace/attr.assoc/attr.evolve (PY-37678)
It is used while inferring call type.

GitOrigin-RevId: 7cab8246784307328c83c956f2d1644a1e4296c8
2019-12-05 14:31:31 +00:00
Semyon Proshev
64470fd40d Don't add an ancestor's field as a parameter if it was overridden with init=False (PY-35548)
GitOrigin-RevId: 75b1a1c3d1852b98a58d066d6380f04e5dd013bd
2019-12-05 14:31:31 +00:00
Semyon Proshev
26d590e73a Fix processing inherited attributes with defaults provided from decorated methods (PY-34798)
GitOrigin-RevId: c4c265201218130ce2cac1611cd514e57d29fd8a
2019-12-04 15:33:19 +00:00
Semyon Proshev
1efa876ad0 Support kw_only in attr.s (PY-34374)
GitOrigin-RevId: a8e78103f3373c967cd429b21e0ced0d530b468d
2019-12-04 12:33:00 +00:00
Semyon Proshev
9ef2a6f638 Update parsing of attr.s for all the changes introduced in 19.2.0 and before (PY-36113, PY-38400)
GitOrigin-RevId: 11db701c16986bc8704f139f60a85f5b9c32a509
2019-12-04 12:33:00 +00:00
Mikhail Golubev
13b6bac7af PY-7711 PY-36912 Don't spell check strings containing injections
rather delegating to the spell checker of the injected language.

Otherwise, we either just report typos twice (PY-36912) or, worse, report
numerous false positives since we try to apply tokenization rules for Python
to a different language as we notoriously have been doing all this time for
injected regular expressions.

Implementations of spell checkers for other languages such as Java or
JavaScript have been using this policy for ages.

GitOrigin-RevId: d1a2a3d48b7a5efff0dbb32ec2847fba1482f3a8
2019-12-04 12:07:42 +00:00
Semyon Proshev
c2ca6a2804 Update expected modules and their paths for tensorflow >= 2.0.0rc0
GitOrigin-RevId: bb599dffcd13d8c232534d276b9c44e2810968cf
2019-12-03 13:14:10 +00:00
Ilya.Kazakevich
9409409a90 PY-17933: Rename refactoring: cannot find reference to attribute defined in another file
Code only checked functions. Attributes were ignored.

GitOrigin-RevId: a1792463fa31c55aed469e2e0c60218aceab16cf
2019-11-27 15:10:05 +00:00
Lada Gagina
03b5d990d8 IDEA-CR-55284: PY-38412 Fix unstubbing in case of TypedDict creation with class-based syntax
GitOrigin-RevId: 3d165abaa22d6fa31d63964c8a7fa828fdefd1dd
2019-11-26 11:02:56 +00:00
Andrey Lisin
eb956ca29d PY-38378 PY-38424 Fix updating variables in debugger console
We now access the `frame.f_locals` attribute only once. Multiple access leads to the loss of the changes we have made. We also alter the second argument of the `PyFrame_LocalsToFast()` to 1 to ensure that all the deleted variables will be wiped out from the frame locals.

(cherry picked from commit 28abff39b2c37f30651db220e8700032a629ce73)

GitOrigin-RevId: 8514da7ec187c1192ea9cdf851f89f008242fc30
2019-11-25 09:31:23 +00:00
Lada Gagina
0f51507660 Add tests and fixes to TypedDict support
PY-38422 Unify warning message for 'clear' and 'popitem' TypedDict methods
PY-38505 Infer proper type for TypedDict subscription expressions
PY-38439 Fix TypedDict consistency check
PY-38415 Fix TypedDict keys order in parameter info
PY-38413 Add * before all arguments in TypedDict parameter hint
PY-38873 Fix detection of TypedDict subscription expression type when value is a dict, Dict or TypedDict

GitOrigin-RevId: 25ff441042f2e2d7791e28632a5016fb367685df
2019-11-22 21:03:15 +00:00
Semyon Proshev
cff3f1f86d Enable pyi-stubs for os (PY-23258, PY-21395, PY-21394, PY-21397, PY-17420, PY-28984, PY-27584)
GitOrigin-RevId: 34ecf07bc68276e62315d01f3c3347f79026ec65
2019-11-20 11:37:02 +00:00
Andrey Lisin
ba365df917 PY-38941 Support debugging of processes created with posix_spawn
(cherry picked from commit e55c2168595e22e80a8f95c2e3812cf7f687c31c)

GitOrigin-RevId: 4db4aaaa9ce7198cfb5177bac262f9f72b92cdee
2019-11-19 17:05:35 +00:00
andrey.matveev
d0162ef760 PY-11977 Refactor code in PyClassTypeImpl and Move type check test from Py3TypeCheckerInspectionTest to PyTypeCheckerInspectionTest
GitOrigin-RevId: b7ffd64d983af6447fd35495ecf433d23b0d2855
2019-11-19 07:11:28 +00:00
andrey.matveev
fbac792547 PY-11977 Fix warning when passing class as parameter to method expecting fields from meta class
GitOrigin-RevId: ec65fbb39ebd8dd23e7f8a71882e7eeb9c283d38
2019-11-19 07:11:28 +00:00
Andrey Lisin
5997fbedf0 PY-38490 Fix debugging when special symbols are in file path
(cherry picked from commit c69c6d560f47552b736cd530106447de19e85e90)

GitOrigin-RevId: a29879d863e635020caf4322f8378b5789246a93
2019-11-15 16:31:36 +00:00
Mikhail Khorkov
5ccf34e0cd PY-16868 Fix test resource file name (move to uppercase)
GitOrigin-RevId: 54c571e82f0ebdfa49d9c08555cc21c2dc21aaf9
2019-11-13 05:32:13 +00:00
Mikhail Khorkov
77c8ea0b13 PY-16868 Fix test resource folder name (move to lowercase)
GitOrigin-RevId: 9bb22014c09976a5a63ea8b6cdc66b9910cacd37
2019-11-13 05:32:13 +00:00
Ilya.Kazakevich
75291026e7 PY-29614: Subtests are broken when have names.
Fixed on teamcity-runners side. This commit updates em to the latest version and adds test.
See https://github.com/JetBrains/teamcity-messages/issues/221

GitOrigin-RevId: 2538e88844be6b0f337983e2629985c872ac4f71
2019-11-12 16:40:42 +00:00
Mikhail Khorkov
403f8d9d8b PY-16868 Fix test resource file name (move to lowercase)
GitOrigin-RevId: 9b94208736d1e06f15d63c64b6a763c54a7bb05e
2019-11-12 11:34:13 +00:00
Mikhail Khorkov
ba25d399f9 PY-1421 Update test data for all 'unused import' inspection report message
GitOrigin-RevId: 1f0cbb85d9b062265f2b93e2746c11f8e72b0bff
2019-11-12 10:10:18 +00:00
Mikhail Khorkov
274387096d PY-16868 Disable property declaration inspection in .pyi file
We do not need to check property decorator in .pyi files at all.

GitOrigin-RevId: b0a9e06fd462a518437403193c270700158406c2
2019-11-12 08:31:53 +00:00
Semyon Proshev
8d1b70c5bb Drop psi builder cache on pushing or popping parsing scope (PY-36167)
Since builder could cache something related to the current scope (e.g. token type)

GitOrigin-RevId: ffabda058dac874bd9187fa27d30b823f782fcf6
2019-11-07 02:40:58 +00:00
Ilya.Kazakevich
b4e6e537b6 PY-38775: Generate tests even for empty classes.
When user wants to generate test for class ``SpamEggs`` that has no methods:
* For pytest generate "test_spam_eggs" function
* for UniTest "class TestSpamEggs"

``PyTestCreationModel`` also rewritten a little to make it slightly more readable.

GitOrigin-RevId: cc5d774ad684844f5fd9c86634dbcd0d2343437f
2019-11-07 02:40:58 +00:00
Andrey Lisin
a7293b3881 PY-23492 Properly handle percent sign in data frame column names
(cherry picked from commit 9e9ca85bb307c9fb784998bc49732b6c2674158b)

GitOrigin-RevId: 9ed3bae6c8776f6be4e504b297e7c0e838420eaa
2019-11-07 02:40:58 +00:00
Semyon Proshev
7c242060fc Enable pyi-stubs for __future__, cPickle and numbers
No `Lib` and `python_stubs` folders in MockSDK2.*
No `python_stubs` folder in MockSDK3.*

GitOrigin-RevId: 9918e003b86ba1fde0c85ab56469c586f0f07171
2019-10-21 14:35:20 +00:00
Andrey Vlasovskikh
c355b9b11c PY-33254 Complete file paths in string literals assigned to variables that has something about file paths in their names
GitOrigin-RevId: 01a4dfc57348608597fbc13ce17fecdaa7c08e38
2019-10-16 18:24:09 +00:00
Andrey Vlasovskikh
3fc1c14fbe PY-33254 Provide soft file references for string literals where path is expected
GitOrigin-RevId: 58daa415d93784bda27b55b5e3339c4c8eda83b8
2019-10-16 18:24:09 +00:00
Lada Gagina
8abae98db4 IDEA-CR-52805: PY-36008 Add support of TypedDict
TypedDict was introduced in https://www.python.org/dev/peps/pep-0589

GitOrigin-RevId: cca138735c7927302214accde298b2f5aae20b48
2019-10-16 17:37:07 +00:00
Mikhail Golubev
5c9ec47997 PY-35961 Report missing parentheses in return/yield depending on language version
Previously it was done unconditionally for all Python versions in StarAnnotator.
I moved the corresponding checks from there to CompatibilityVisitor so that
it was clear in which particular versions it's mandatory.

GitOrigin-RevId: 205de8768431445baed98aecd5f9820efe28d281
2019-10-14 17:02:52 +00:00
Mikhail Golubev
895d00f457 PY-35961 Report redundant parentheses in yield statements with tuple unpacking
Unless it's a "yield from" syntax, where parentheses remain mandatory in Python 3.8.
Additionally, properly suggest removing parentheses in yield statements with
ordinary parenthesized tuples -- previously we ignored them because of a too
broad exclusion.

GitOrigin-RevId: 0c695a9fb95f831625ce907ffb272cced0e9fb8b
2019-10-14 17:02:52 +00:00
Mikhail Golubev
7adf90bfe7 PY-35961 Consider returns with tuple unpacking in "Redundant parentheses" inspection
Namely, it report parentheses in such return statements as redundant staring
from Python 3.8.

GitOrigin-RevId: 0603ddb784533b8824bd2266d1fac26d307931fc
2019-10-14 17:02:52 +00:00
Semyon Proshev
942e65fe42 Sync with typeshed @ 7e99848b2c9e8982873ad87cfe3f6ffc44549df0
Excluding https://github.com/python/typeshed/pull/3252

GitOrigin-RevId: f6d802b1a50d6071f1a1027017750e4dc65ece26
2019-10-14 16:00:50 +00:00
Elizaveta Shashkova
028a0c2372 IDEA-CR-53299: PY-37497 Variables View cleanup
GitOrigin-RevId: 2d7ce065e5b42f6a43320ffd735f978851529805
2019-10-14 10:32:59 +00:00
andrey.matveev
92e41799f2 PY-37720 Impl python ml completion features
GitOrigin-RevId: 3b8029ab460672b286d7b1cf96fd35bf9c57bf59
2019-10-11 08:01:46 +00:00
Semyon Proshev
86918338e9 Reapply fec8e404 and 6a55c56f
GitOrigin-RevId: 982946bc2be86d36753a998d9311160bce7b0a1e
2019-10-08 16:33:06 +00:00
aleksei.kniazev
16786f4b89 added inspection for deleted variables with no qualifiers (PY-4537)
- treat deletion by slice and subscription expressions as read access
- delete instruction in dataflow only inserted for PyReferenceExpression

GitOrigin-RevId: 72ae5e964a1e287e007dabb8f41433b284523a02
2019-10-02 13:08:48 +00:00
Aleksei Kniazev
adbbcef28a intention actions to switch between absolute and relative imports (PY-37858)
GitOrigin-RevId: 8c3c1caeba64ff678c8f1dafdd0fc9a44af3873e
2019-10-02 12:03:38 +00:00
Aleksei Kniazev
d76fed8eba fixed case sensitive dir name in test data
GitOrigin-RevId: 44f223ed087eaec0820a2f11d5fd628538b7137a
2019-10-02 10:07:03 +00:00
Aleksei Kniazev
2d72c69170 relative imports should be inserted instead of absolute ones when possible (PY-6054)
If the file already has relative imports, next one inserted via completion/auto-import has a chance to be relative. For that new import has to have the number of dots <= than the max of the file's relative import and a number provided by a registry value in 'python.relative.import.depth', that is 3 by default. It also has to be located in the same root package, since python doesn't allow relative imports to step outside of it. The file must not have "if __name__ == '__main__'" in it, since it suggests that it is intended to be runnable and relative imports will not work.
Relative import statements can also be updated with new import elements, if the user's codestyle allows it.

GitOrigin-RevId: 766a03e2252bb1f8193a2156831cc8fdf0a7aced
2019-10-02 10:07:03 +00:00
Ilya.Kazakevich
ef0b36a968 PY-37841: Do not monkeypatch prepareconfing in pytest: leads to double plugin loading.
With testdir fixture, pytest runs test under separate pytest (which may be inline or separate process).

Previously we monkeypatched prepareconfig not to call it twice.
But this approach fails with testdir, because same config returned twice leading to double plugin registration.
See comment in YT

GitOrigin-RevId: bd9f11a2a10900fa3c059791d7c0183a20b1ed70
2019-10-01 00:31:27 +00:00