Mikhail Golubev
2e8e817447
PY-63371 PY-63372 PY-63373 Recognize type alias names in their definitions as targets for actions
...
In particular, for Rename and Go to Declaration or Usages.
GitOrigin-RevId: 760a28b3a2a2b22022e938d7b4b96729cd7f7dc2
2023-10-05 22:02:24 +00:00
Mikhail Golubev
7f152c983f
PY-59594 PEP 701: Make the Inline refactoring aware of the new f-string grammar
...
(cherry picked from commit 4fe1044cadef561f369a77ddbe98ff29e6fcc5a2)
IJ-MR-115763
GitOrigin-RevId: 5cf7b9d61ea546e0a9e30c0c8a1d432d79e0738e
2023-09-29 09:33:55 +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
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
Mikhail Golubev
3c6a3baf1a
[python] Fix an error when extracting a part of string with %-style formatting
...
Namely, if substitution values were passed as non-literal value compatible with
collections.Mapping, use plain string concatenation. The existing condition for
that was wrong.
GitOrigin-RevId: b6e9b9c615d80aa7842f883086b3544e095d5f81
2023-03-29 21:30:27 +00:00
andrey.matveev
d0e0488fe6
PY-40797 Fix problem with inline string to f-string
...
GitOrigin-RevId: dbc2206fa2338e2b6a2552a0ca76cb4064425505
2022-11-03 17:30:23 +00:00
Irina.Fediaeva
cce0ef17d5
PY-16760, PY-28549, PY-35743, PY-55609, PY-46654: Correct resolve of class attributes in docstrings
...
Previously in docstrings we incorrectly recognized references in 'Attributes' section only as instance attribute references. It led to false positive 'Unresolved reference' on class attributes references in docstrings and wrong resolve when using class and instance attributes with the same names. Now we use ReferenceType.VARIABLE to identify both class and instance attribute references in 'Attributes' section and then resolve them with priority of instance attributes. Also fixed wrong resolve of attributes references to constructor parameters.
GitOrigin-RevId: ea10bfb092472c0ab14b77f06efd93093cfcd684
2022-08-25 21:11:57 +00:00
andrey.matveev
04f5b85d4a
PY-29898 Impl resolve keyword argument to dataclass attribute
...
Also fix PY-55231
Add declarationElement field to callable parameter to resolve parameters to class fields in dataclasses
GitOrigin-RevId: ae2703b958061df6f2d74b19920a6e3be2a084f6
2022-08-05 11:19:33 +00:00
andrey.matveev
368055ab2d
PY-42682 Add test adding keyword vararg to the end
...
(cherry picked from commit acad2e8c5c5aee3da51bb27c294a381ac7364599)
IJ-MR-22901
GitOrigin-RevId: d15a773341632dac6c4255f81b8b52a014cc3fce
2022-04-05 10:34:10 +00:00
andrey.matveev
157b37920e
PY-42682 Fix IncorrectOperationException when adding keyword vararg to signature
...
(cherry picked from commit 24a4542fc09784ed4359ed558cd5a8e49b29bf1c)
IJ-MR-22901
GitOrigin-RevId: 6cd2544783580312e1194b3d76e47f9db88fbdf3
2022-04-05 10:34:08 +00:00
andrey.matveev
07ebb19aee
PY-33843 Fix problem with extracting constant from comprehension
...
(cherry picked from commit 72bb8e523471c9922ae3d8f95f7fa9ce1fe0009d)
IJ-MR-18836
GitOrigin-RevId: dadb7cf489a0501b834cff7e10979fab2c8ae8cd
2022-01-13 07:40:36 +00:00
Daniil Kalinin
e7421b36cf
PY-12106 Add newline when moving function to new file
...
Update all the /refactoring/move test sources according to the new rule - an empty line is always added after the move
(cherry picked from commit c00d1a499fb9849650eb102dd8bb5380165a1eee)
IJ-CR-17177
GitOrigin-RevId: d436af21c20ddd08b78886a333e6f98c71bcc19b
2022-01-10 09:40:19 +00:00
andrey.matveev
f4e98200ee
PY-16221 Impl moving add from future imports when move
...
(cherry picked from commit b1cd64885d96c560976a29db9f5625a29df6d6ef)
IJ-MR-14916
GitOrigin-RevId: 5439442556b3d8ea2680d833109ac86559b765c1
2021-10-18 16:30:24 +00:00
Irina Fediaeva
086905baef
PY-23831: Add imports for references from type hint comments during 'Move' refactoring.
...
(cherry picked from commit c4e5e33459d273b159760a45f528ff1d38c55add)
IJ-CR-13802
GitOrigin-RevId: 3e78b51151d9803e870164c1f2d3d783c61071f7
2021-10-16 07:08:19 +00:00
Mikhail Golubev
1421975c96
PY-48012 Resolve and complete attributes in PEP 634 class patterns
...
Both are implemented other the type of the corresponding class.
References resolve to any readable attribute of a class, however
some obviously wrong variants such as special "dunder" attributes
and methods are intentionally excluded from completion suggestions.
GitOrigin-RevId: 5edac14f47cba39840b15b0dd7f21e2e46077261
2021-10-15 17:36:56 +00:00
andrey.matveev
aa5eb8dc43
PY-23500 Impl considering dependencies for introduce constant fix
...
(cherry picked from commit fe2adaeabbf1862c2f51a93df14995264a251cca)
IJ-MR-5221
GitOrigin-RevId: 08d0db849d31cdf7684a1b7a68d68072cc0d3686
2021-10-12 17:44:11 +00:00
andrey.matveev
3c3b2b3d0d
PY-21937 Fix renaming both py file and corresponding stub
...
(cherry picked from commit b341320616a4af0243b58f572382938cf3f42a69)
IJ-MR-11194
GitOrigin-RevId: 2e940c470f08617e260ff545ed57e41561981cc1
2021-07-21 09:19:15 +00:00
Ilya.Kazakevich
38406a3b71
PY-21099: Store dependency information and use it for refactoring, obey target ref. dependency
...
* Dependency info may be lost when new member is created, so we store it on PSI level
* Support target reference dependency
* Method can't be abstract when property depends on it
GitOrigin-RevId: 24b9b64ef4ce60dd19bc4696e1d7aabf6a260067
2021-07-20 20:44:47 +00:00
andrey.matveev
62fa782cbf
PY-21938 Fix renaming method declared in psi stub
...
(cherry picked from commit 9dd1de942ff78e9af66e54b69b397115057cc718)
IJ-MR-10920
GitOrigin-RevId: ac2b5d214ab1613cd2d954b12c03e594efe69b50
2021-06-29 18:28:23 +00:00
Mikhail Golubev
f76600603e
PY-46099 PY-47633 Don't remember usages in non-physical copies of methods in Pull Up/Down
...
PSI element copies exists in special non-physical files (DummyHolders),
and usually references in them cannot be resolved. It led both to exceptions,
when the rest of the code insight didn't expect resolve to happen in files other
than PyFile (PY-46099), and situations when we failed to resolve a usage in
a copy and restore the corresponding import (PY-47633).
Switching to processing original declarations also revealed a problem with
inserting imports -- we might have tried to insert impossible imports for
non-top-level symbols, such as class attributes and methods. Now, these are
ignored.
GitOrigin-RevId: 6816078596a2c0aced7045a80828b7e83ebee8c0
2021-03-23 21:14:17 +00:00
Semyon Proshev
56a1c00c2a
Make python-latest project descriptor default in tests
...
Update test data and reduce manual language level setup
GitOrigin-RevId: d6ddec1b2b29a2b7f1a34cfb5982fd975de78d65
2021-03-15 17:33:04 +00:00
andrey.matveev
0763dc23f0
PY-46099 Fix ClassCastException in FlaskSQLAlchemyTypeProvider
...
(cherry picked from commit f939dd3ae0b9811a7389c82408f8e973bf5ef2a3)
IJ-MR-5058
GitOrigin-RevId: 6b1b00fe2b7c31756a213d7729bd273095cfc9b6
2021-03-15 13:15:38 +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
Semyon Proshev
abe238bc27
Use direct analyze of parameters, type inference returns parameters from a stub (PY-42285)
...
GitOrigin-RevId: ee2b44c9f4f8b77a20a9aa783ad8be2c4addb2c0
2020-06-08 18:00:53 +03:00
Semyon Proshev
99cdc2197b
Suggested rename refactoring for Python (PY-42285)
...
GitOrigin-RevId: 73a699111b968abae93dbfa802b568f734c9a1e8
2020-05-12 12:45:49 +00:00
Mikhail Golubev
cf1663d168
PY-41230 Add tests on validation related to positional-only parameters
...
Most of it already existed as part of PEP 570 support but lacked testing.
GitOrigin-RevId: 4eca1b0b35bbe8c1f4e8bbe241e3ad4c0ca2e392
2020-04-17 12:46:38 +00:00
Mikhail Golubev
a22e843682
PY-41230 Handle positional-only marker "/" in Change Signature
...
GitOrigin-RevId: b201d62ab4cec02d707a4aaee3b5f6607b11d2fe
2020-04-17 12:46:38 +00:00
Mikhail Golubev
75aa86a60c
Refine existing tests and add new ones on default parameter validation
...
GitOrigin-RevId: 79accefa3b8542088cfa68cc44ae79ca911e7a29
2020-04-17 12:46:38 +00:00
Mikhail Golubev
903ac1d552
PY-26715 Arguments after an existing parameter using its default get keyword form
...
GitOrigin-RevId: b57c15fdf40b02afcf12bff40be906c232e15ede
2020-04-17 12:46:38 +00:00
Mikhail Golubev
b044c8811a
PY-33487 PY-30874 Properly account implicit arguments in Change Signature
...
Instead of just relying on the fact that some of parameters is named "self".
GitOrigin-RevId: c9c0d1d4bbcecb93a84a3dc451485fa70790ca6d
2020-04-17 12:46:38 +00:00
Mikhail Golubev
8487b4cf70
PY-22023 Don't try to update subclasses' constructors in Change Signature
...
Accordingly, don't ask to modify "overridden" constructor of a base class.
Unlike other methods, constructors in the hierarchy usually don't mean to
have identical signatures, thus it's not safe to blindly sync them this way.
GitOrigin-RevId: 61e300914831c726afea3928acd110fea8428df8
2020-04-17 12:46:38 +00:00
Mikhail Golubev
a9a90d6ff6
PY-38076 Change Signature keeps used **kwargs arguments in calls
...
GitOrigin-RevId: 003267aa894c663c2da3750bd5eed5bdf8b8e5ab
2020-03-23 11:32:35 +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
Semyon Proshev
a799c255fe
Fix introducing variable for argument passed to unnamed parameter (PY-37555)
...
GitOrigin-RevId: 6a595635c62bac01e6bdb6cbbd284eb52a64f16f
2019-09-16 16:01:43 +00:00
Aleksei Kniazev
87224ec7bd
IDEA-CR-51115: 'inline this invocation only' option should not be available when calling inline on function declaration (PY-37335)
...
GitOrigin-RevId: 42021bca7333b16a38fc8eb0a6fae0ca56640f54
2019-08-29 14:09:57 +00:00
Semyon Proshev
57216e2429
Extract some tests to separate test cases because they need Python 3 typeshed roots (PY-33830)
...
Remove `abc.py` used in tests and mock sdks
GitOrigin-RevId: 8f27bb056ccfbcd7961c48298b0076bed4cd0389
2019-08-19 19:59:56 +03:00
Aleksei Kniazev
33632c12c2
IDEA-CR-49790: function inline: already imported names should not be reimported (PY-36803)
...
GitOrigin-RevId: b2bd04bcfc09898db6accd94210fb8c2097e7c92
2019-07-09 13:03:53 +03:00
Aleksei Kniazev
2d720aea16
IDEA-CR-49176: fixes after review of function inline for python
...
- codestyle improvements
- reuse TypeEvalContext and PyResolveContext
- check PyDunderAllReference specifically to avoid unwanted side effects
- skip resolving PyTargetExpression
- replace references with import alias in the refactoring, instead of the utility method
- added single reference search for PyStringLiteralExpressionImpl
- cleanup obsolete tests
GitOrigin-RevId: 3e33c880a8fe116a5b98583059c83b7dd67e34a2
2019-07-08 18:05:36 +03:00
Aleksei Kniazev
e867306f59
IDEA-CR-49176: inline function: optimize imports at declaration site after removing function definition (PY-36721)
...
GitOrigin-RevId: 2bf0ffdeff5a2b5cd084b53b5e1ed76d547d07f2
2019-07-08 18:05:36 +03:00
Aleksei Kniazev
d672b03510
IDEA-CR-49176: improved check for self usage when inlining a function (PY-36471)
...
GitOrigin-RevId: 3e99835432e2b5382c257bbe4375aacb94da16bc
2019-07-08 18:05:36 +03:00
Aleksei Kniazev
0bceb70531
IDEA-CR-49176: select distinct files before optimizing imports (PY-36484)
...
GitOrigin-RevId: 48b187e19ee36fd274c1670ecc388c661f11f774
2019-07-08 18:05:36 +03:00
Aleksei Kniazev
a4091e6051
IDEA-CR-49176: function inline: remove docstring, keep the first comment, unless it's a type comment(PY-36714, PY-36491)
...
GitOrigin-RevId: d7de37f5a7b3b62cc6015e2ff3dbdad5cafe3641
2019-07-08 18:05:36 +03:00
Aleksei Kniazev
faf4d0b5cc
IDEA-CR-49176: function inline: import elements from function scope with alias if there is a name clash (PY-36642)
...
GitOrigin-RevId: 992b1d44d248725f31f599d53efdd4e4b854824a
2019-07-08 18:05:36 +03:00
Aleksei Kniazev
f6c70470d6
IDEA-CR-49176: function inline: remove typing overloads together with the function (PY-36465)
...
GitOrigin-RevId: ef532069cd2d8bb06b35fb7d6ef7be2563b9b76d
2019-07-08 18:05:36 +03:00
Aleksei Kniazev
1b5d272f4e
IDEA-CR-49176: function inline: qualifier is not extracted into declaration if the method does not use 'self' (PY-36471)
...
GitOrigin-RevId: 94a3604d54fd957e9744e7f3f6b632cb7924e4fb
2019-07-08 18:05:36 +03:00
Aleksei Kniazev
ed8952cbf0
IDEA-CR-49176: reference in __all__ removed if target function if removed after inline (PY-36467)
...
GitOrigin-RevId: 670d6ee44d704c075319af42e3054c7bc9ca7bed
2019-07-08 18:05:36 +03:00
Aleksei Kniazev
8800f4763c
IDEA-CR-49176: function inline is disabled for overridden methods (PY-36464)
...
GitOrigin-RevId: 0f24072270482a4d221a7eab6b3f0d6de19c0e35
2019-07-08 18:05:36 +03:00
Aleksei Kniazev
72e1763f81
IDEA-CR-49176: disallow function inlining for python special methods (PY-36461)
...
GitOrigin-RevId: e1049aec62e8c8240a555fdf818820e797d5c9a6
2019-07-08 18:05:36 +03:00
Aleksei Kniazev
3749eba8e1
IDEA-CR-49176: inline function is made possible for functions with lambdas (PY-36373)
...
GitOrigin-RevId: 4f2603447f760d959d31d5033944bae85ad68bf8
2019-07-08 18:05:36 +03:00
Aleksei Kniazev
72e24eef45
IDEA-CR-49176: inline function doesn't copy docstring, but keeps the first-line comment (PY-36469, PY-36491)
...
GitOrigin-RevId: db1fbb5178892db955678dfcec684a5af7f987c6
2019-07-08 18:05:36 +03:00