Commit Graph

44 Commits

Author SHA1 Message Date
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
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
Semyon Proshev
fff6955833 Move adding metaclass method (PY-30789) 2018-07-17 20:27:51 +03:00
Mikhail Golubev
8769595543 PY-18216 Move and other refactorings don't run full-blown optimize imports
but rather only delete unused imports so as not to cause unwanted
changes in affected files.
2017-10-23 18:58:30 +03:00
Mikhail Golubev
e6ec37ccfe PY-19705 Add blanks lines around methods of a class as required by PEP 8 2017-07-28 15:23:31 +03:00
Mikhail Golubev
956587f1d3 Merge branch 'east825/google-code-style-docstrings'
Conflicts:
	python/src/com/jetbrains/python/documentation/PyDocumentationBuilder.java
	python/src/com/jetbrains/python/documentation/PythonDocumentationProvider.java
	python/src/com/jetbrains/python/psi/impl/PyFunctionBuilder.java
	python/testData/quickdoc/NumPyOnesDoc.html
2015-09-15 16:13:22 +03:00
Mikhail Golubev
2b0a11e466 PY-12018 Sort import by their types and names similar to the behavior of isort
Normal imports go first, then "from" imports.
2015-09-10 19:02:53 +03:00
Mikhail Golubev
fc8ea56374 PY-16747, PY-16770 generated abstract methods preserve formatting and prefix of original docstring 2015-09-02 14:35:41 +03:00
Mikhail Golubev
7e94358f1d Various class refactorings merge several "from imports" from abc module together 2015-06-22 17:33:57 +03:00
Mikhail Golubev
4237819376 PY-14765 Two "from imports" with the same source module are ordered by the first imported name
Additionally star imports always come first
2015-06-22 17:33:57 +03:00
Mikhail Golubev
4b6a497aec PY-14765 Move stubs for "abc" to mock SDK, so its symbols were resolved as built-ins when imports are inserted 2015-06-22 17:33:56 +03:00
Mikhail Golubev
32b76de893 PY-11552 Keep maximum 1 empty line between declarations and in code by default
Fix affected test data where reformat is invoked during refactoring.
Also use entire sample provided by user in the corresponding test case
for the issue.
2015-04-27 20:34:47 +03:00
Mikhail Golubev
31eeb5e84a Fix test data in several tests that failed after PyUtil#deleteElementSafely was introduces
* `pass` is consistently inserted on the new line now
* excess spaces left after element was deleted are removed

Use PyUtil#deleteElementSafely in pull, push and extract superclass
refactoring implementations.

It turned out that all problems with whitespaces left after we moved
function are rooted in awkward implementation of PyFunctionImpl#delete()
that delegated to plain AST manipulation and thus ignored
usual additional reformatting step. I removed it and it's allowed to
clean a lot of test files and remove the code that was added previously
exactly for this purpose in PyMoveSymbolProcessor.
2015-04-08 13:46:26 +03:00
Ilya.Kazakevich
94ae901e73 PY-12178 Support pull up / push down for properties 2014-03-04 21:35:21 +04:00
Ilya.Kazakevich
dd2e76a0ff PY-12178 Support pull up / push down for properties 2014-03-04 17:14:00 +04:00
Ilya.Kazakevich
3717b9aaea PY-12178 Support pull up / push down for properties (not ready yet: only properties excluded from other managers) 2014-02-26 21:05:39 +04:00
Ilya.Kazakevich
470d4d0ac5 PY-12213 When moving, members should be sorted according to their dependencies 2014-02-26 00:30:40 +04:00
Ilya.Kazakevich
ce073a7549 PY-12196 Members moving refactoring should handle dependencies 2014-02-20 16:49:36 +04:00
Ilya.Kazakevich
045a753eb8 Display conflicts if destination class already has some member 2014-02-18 21:23:33 +04:00
Ilya.Kazakevich
f20e01f8a7 PY-12170 Extract Superclass: breaks code when extracting fields not defined in __init__ 2014-02-17 18:26:22 +04:00
Ilya.Kazakevich
262ff802fe AbstractMethods copies docstrings 2014-02-17 17:38:40 +04:00
Ilya.Kazakevich
b32156d3c5 PY-2858 Pull Up Abstract Method (finally!) 2014-02-14 22:03:37 +04:00
Ilya.Kazakevich
4fb93167e2 PY-10963 Pushing methods down should add needed imports fixed 2014-02-11 23:03:09 +04:00
Ilya.Kazakevich
fe6b753f5b PY-10963 Pushing methods down should add needed imports (test only added) 2014-02-11 16:16:13 +04:00
Ilya.Kazakevich
735084d8d4 Refactoring to make PushDown use the same engine as other refactorings (need to doc) 2014-02-10 23:57:19 +04:00
Ilya.Kazakevich
24c879c5f5 Code cleanup for "membersManager" package to make it type-safe
PullUp: Refactored to use Processor on MembersManager

StatementList refactoring

PullUp: processor added

PyExtractSuperClass and PyPullMembersUp refactored and covered with tests.

PyExtractSuperClass and PyPullMembersUp refactored and covered with tests.
2014-02-06 18:31:49 +04:00
Ilya.Kazakevich
955663ad6c PY-3450 Refactoring: pull up class variables/attributes (almost done: need to check dependencies, resolve conflicts and use same functionality for "extract superclass" and "pushdown") 2014-02-04 00:47:26 +04:00
Ilya.Kazakevich
594f81b6cd PY-3450 Refactoring: pull up class variables/attributes: Refactoring and wrongly formatted code does not lead to exceptions in pull-up method anymore 2014-02-03 21:43:43 +04:00
Ilya.Kazakevich
7ae9d1d2b1 PY-3450 Refactoring: pull up class variables/attributes: Fixed, but refactoring is required. 2014-02-03 18:35:53 +04:00
Ilya.Kazakevich
f98b4ed4da PY-11958 PullUp refactoring breaks class signature if class has more than 2 ancestors 2014-01-29 19:46:58 +04:00
Ilya.Kazakevich
003d00cee4 PY-11968 "Pull member up" refactoring should not allow user to move member up if parent already has one
PY-11290 Target classes of "Pull Members Up" refactoring should be sorted in ancestry order
PY-11289 "Pull Members Up" should not hoist code into python stubs/skeletons.
PY-11288 Better default for target of "Pull Members Up" refactoring
2014-01-29 18:53:13 +04:00
Andrey Vlasovskikh
b5874c65f6 Introduce substring for new-style formatted strings (PY-8372) 2013-01-10 21:20:51 +04:00
Dmitry Trofimov
67bcf88cbd Revert "Revert "Merge branch 'master' of git.labs.intellij.net:idea/ultimate""
This reverts commit 3a2ad1f6c248ce02e860be14b796981de7ccfeee.
2011-02-04 17:17:18 +03:00
Dmitry Trofimov
819731653c Revert "Merge branch 'master' of git.labs.intellij.net:idea/ultimate"
This reverts commit 8c63477c4990c0667109c41ec0db1336ef689d68, reversing
changes made to 3478dde5d0c91ad1cce33478d005748849dcb85f.
2011-02-04 15:29:58 +03:00
Dmitry Jemerov
547fd75395 one more test 2011-02-02 17:50:32 +01:00
Dmitry Jemerov
deff48c064 don't try to import references that resolve in the method being pulled up (PY-2810) 2011-02-02 17:50:11 +01:00
Dmitry Jemerov
c9136f1bb8 PEP 8 compliant option for blank lines between top-level classes/functions (PY-2765) 2011-01-26 20:21:39 +01:00
Dennis Ushakov
040fc132cb do not move class comments 2010-10-12 19:15:21 +04:00
Dennis Ushakov
cb3da1fa81 PY-349 2010-07-16 09:25:53 +04:00
Dmitry Jemerov
4552fdc196 fix expected testdata for new formatter behavior 2010-02-03 19:57:10 +03:00
Dennis Ushakov
d6f7bf1abb fixed tests
PY-371
2010-02-03 13:20:00 +03:00
Dennis Ushakov
4400949461 fixed testdata 2010-01-25 18:47:22 +03:00
Dennis Ushakov
ab6954ab49 push down tests and formatting 2010-01-22 14:07:27 +03:00
Dennis Ushakov
35ef49d99f pull up snake 2010-01-19 20:13:27 +03:00