Skip to content

fix(python 106): various fixes #454

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

Merged
merged 8 commits into from
Jun 15, 2024
Merged

fix(python 106): various fixes #454

merged 8 commits into from
Jun 15, 2024

Conversation

TheLeoP
Copy link
Collaborator

@TheLeoP TheLeoP commented May 7, 2024

Should address python problems from #452

@ColinKennedy
Copy link

ColinKennedy commented May 7, 2024

I'm using the latest commit

image

I'm not sure which of the listed issues that this PR addresses so I'll restate each + say which of these are addressed.

In all cases I called require("refactoring").refactor("Extract Function")

Before

class Foo(_Base):
    """Some stuff here."""

    def __init__(self, blah: str) -> None:
        """More things."""
        blah: str = "something"
        do_thing(blah)

        super().__init__(another=10, stuff=8, blah=blah)

After

class Foo(_Base):
    """Some stuff here."""

    def foo(self, blah: str) -> None:
        blah: str = "something"
        do_thing(blah)
        return blah



    def __init__(self, blah: str) -> None:
        """More things."""
        blah = self.foo(blah)


        super().__init__(another=10, stuff=8, blah=blah)
  • The space between the functions is very wide for some reason
    • This works for 2 free functions (functions not in classes)
    • but does not work for class functions still (see the example above)
  • new_function is placed above __init__
    • FWIW I don't think this PR is trying to fix this one
  • def new_function(self, ) gets a trailing , ) when def new_function(self) was expected
  • lots of newlines were left over where blah = self.new_function() was placed
    • Sounds like this would need to be a separate configuration + change and isn't in this PR
  • The refactor saw blah but didn't take into account its typehint and wrote def new_function(self, ) -> None: rather than def new_function(self, ) -> str:

@TheLeoP
Copy link
Collaborator Author

TheLeoP commented Jun 15, 2024

It looks like neovim/neovim#29212 breaks some previous asssumtion about the order of the text eddits. I'm gonna open a differnt issue for that problem

@TheLeoP TheLeoP merged commit e6b10b2 into ThePrimeagen:master Jun 15, 2024
2 of 3 checks passed
@kuator
Copy link

kuator commented Jul 23, 2024

ong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants