Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting method with similar statements fails when it contains list comprehension #461

Closed
lieryan opened this issue Mar 23, 2022 · 1 comment · Fixed by #471
Closed
Labels
bug Unexpected or incorrect user-visible behavior extract-refactor
Milestone

Comments

@lieryan
Copy link
Member

lieryan commented Mar 23, 2022

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Code before refactoring:
class MyClass:
    def my_method(self):
        myvar = [d for d in ds]
        print(1)
  1. Describe the refactoring you want to do: Select the "print(1)" line, and then trigger "Extract method including similar statements"

  2. Expected code after refactoring:

class MyClass:
    def my_method(self):
        myvar = [d for d in ds]
        self.kextracted_method()

    def extracted_method(self):
        print(1)
  1. Describe the error or unexpected result that you are getting
pylsp: error: pylsp-rope: 'PyComprehension' object has no attribute 'get_kind'

Editor information:

  • Project Python version: python 3.8
  • Rope Python version: python 3.8
  • Rope version: rope 0.23.0
  • Text editor/IDE and version: Vim with pylsp-rope 0.1.8
@lieryan lieryan added the bug Unexpected or incorrect user-visible behavior label Mar 23, 2022
@lieryan lieryan added this to the 0.24.0 milestone Mar 23, 2022
@milanglacier
Copy link

cofirmed here, python 3.9 with rope 0.23 has the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected or incorrect user-visible behavior extract-refactor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants