Commit Graph

24 Commits

Author SHA1 Message Date
andrey.matveev
b7398bb63d PY-10719 Fix add import above import with noinspection comment
GitOrigin-RevId: 6dd79b10e56b9e9e2eee76c83d5974dee43446a1
2022-07-26 13:17:54 +00:00
Lada Gagina
315f1905fd PY-46344 Import abstract base classes from collections.abc, not collections
GitOrigin-RevId: d4b7165f09f47c7cca6c3eb47b1e254e5b855b40
2021-11-19 12:04:44 +00:00
Semyon Proshev
fbadbbc40d Sync with typeshed @ 2c8cb605961bf76a88f9c21624893e4368ac3638
Temporarily exclude https://github.com/python/typeshed/pull/4987
Temporarily exclude https://github.com/python/typeshed/pull/5206 from `collections/__init__.pyi`

GitOrigin-RevId: 78775cc6c09fd8d867d8f46bf9908bd5cdbb05f6
2021-04-28 00:06:58 +00:00
Semyon Proshev
2465b8a67d Enable pyi stubs for several modules (PY-41509, PY-46229)
_ast, _dummy_thread, datetimerange, dummy_thread, dummy_threading, formatter, jwt, platform, string, thread

GitOrigin-RevId: a8010a0bd2381712599be0f96b35ce74e3e0c7d2
2021-03-03 22:46:06 +00:00
Mikhail Golubev
55e52c42b6 PY-46361 Don't suggest stubs from legacy python-skeletons for auto import
GitOrigin-RevId: ec56e579d0240cb03b2f16bb468b7a1be6a95762
2021-01-08 16:51:06 +00:00
Mikhail Golubev
4ca188384d PY-46358 Add the actual "as" part to local imports for common package aliases
GitOrigin-RevId: ad1061472e98c66ce3abc0e6d5e633ab271c2b41
2021-01-07 17:25:43 +00:00
Mikhail Golubev
6f5997ee45 PY-46356 Suggest qualified import names for common aliases
I moved the custom index lookup, previously used in PyImportCollector to find
modules and packages, to PyModuleNameIndex, already utilized in other similar,
places such as PyModulePackageCompletionContributor. Two new methods where
introduced to the interface of PyModuleNameIndex for that. The first one
is a generalization of  find(), allowing to re-use an existing search scope, and
the second finds modules by their fully qualified name in the same fashion as
it was done in PyClassNameIndex.findClass().

GitOrigin-RevId: 2de5821351eacf08ddc045454eea189b21fa1186
2021-01-07 17:25:41 +00:00
Mikhail Golubev
8e53b39d77 PY-36374 Exclude subpackages such as "numpy" from suggestions for common aliases
GitOrigin-RevId: 057d139dbe331154f5c4d0106d0e3564d9eda0b8
2021-01-07 17:25:39 +00:00
Mikhail Golubev
3ba2747c51 PY-36374 When suggesting imports, don't shadow package aliases with namesake definitions
Previously, we suggested variants for these well-known aliases only if no
other symbols were found. In particular, having "np" name defined in the
sources of pandas prevented "import numpy as np" from being offered.

ImportCandidateHolder had to be refactored a bit to keep the name of
the corresponding symbol itself, because it used to be taken from the parent
AutoImportQuickFix, which now only holds the name of the reference, and, thus,
"numpy" ended up being imported as "import np as np".

Also, such imports are now suggested higher in the list than the rest.

GitOrigin-RevId: 75bed654431e81e6df40f1400ee4b02a4ab0dcca
2021-01-07 17:25:28 +00:00
Irina Fediaeva
0f6abfba6a PY-44918: Fix resolve path in existing user file instead of the os.path
GitOrigin-RevId: cca701106e1c558a50ed61b85efc312ff9205b1c
2020-12-01 19:44:00 +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
5e814f0e78 PY-23968 PyFromImportStatementImpl.addInternal supports adding new names "before" and at the beginning
GitOrigin-RevId: 838658cf749f62f0da1e9656021a800515073926
2020-03-06 14:07:46 +00:00
Mikhail Golubev
e5a732aec9 PY-23968 Respect the order of names in from imports when adding new names in them
GitOrigin-RevId: 403a24096e72eecde5b0731b2e752cf9b86df3e2
2020-03-06 14:07:46 +00:00
Mikhail Golubev
0fbb674a91 PY-34818 Suggest auto importing symbols referenced in f-strings
GitOrigin-RevId: 433bb6a1247620e994b103d0a5348b23ed642813
2020-03-05 18:33:22 +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
aleksei.kniazev
a4c6f8d8bd IDEA-CR-45845: new ordering rules for completion and autoimport quickfix (PY-20976)
items defined in the project > items from the standard library > items from other libraries
doesn't start or end with _ > starts with _ > starts with _ > starts and ends with __
items with no leading _ in import path > with leading _ in import path
function/variable/class > module/directory
less items in the import path > more items in the import path

GitOrigin-RevId: 7fba600668d7f7eab4dbd5d3891811cfe2501b89
2019-08-01 12:04:14 +03:00
Mikhail Golubev
97977bf50d PY-20100 Update existing "from" imports only when it's allowed by code style
Interestingly, this new code style option affects the text of the auto import
quickfix since the latter reflects whether a symbols will be imported anew or
by extending some existing import.
2018-10-03 17:13:23 +03:00
Mikhail Golubev
58a25d2c34 PY-24450 Suggest importing modules for unresolved decorators without arguments
Because it can be just an incomplete qualified name of the needed callable.
2018-08-15 12:44:23 +03:00
Mikhail Golubev
64b2788857 PY-28752 Show full origin when suggesting symbols from existing "from" imports 2018-03-01 19:07:03 +03:00
Mikhail Golubev
5cdbe09648 PY-16176 Existing imports are suggested first in auto import quickfix 2018-03-01 19:07:03 +03:00
Mikhail Golubev
14463e6bde PY-16176 Always explicitly suggest all possible variants of imports
even when some existing imports offer the name in question, as
quite often multiple stdlib and third-party modules define
the same name.

I've also restored functionality PyAddImportQuickFixTest after recent
changes in it that precluded checks of individual import candidates.
2018-03-01 19:07:03 +03:00
Mikhail Golubev
89eb73790a PY-25234 More efficient way to check that a user skeleton belongs to the stdlib
Also, I added a test on that scenario using the skeleton for "alembic"
as an example.
2017-12-11 20:19:51 +03:00
Mikhail Golubev
0d89738e05 PY-25234 Fix ordering for imports resolved into binary skeletons of stdlib
Previously, we used the priority of the binary skeletons directory
itself, thus placing them in a wrong THIRD_PARTY group.
2017-10-23 18:58:30 +03:00
Mikhail Golubev
532e18e4d9 Add "Py" prefix to AddImportQuickFixTest and several other quick fix tests
otherwise it's easy to overlook it especially considering that there is
also (confusingly) PyAddImportTest
2017-03-21 18:10:12 +03:00