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

Add rename method from TODO list #116

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

b5y
Copy link
Contributor

@b5y b5y commented Aug 11, 2016

Add rename method with tests. Remove task from TODO list. Update CHANGELOG.

@@ -1020,6 +1021,14 @@ def replace(self, new_node):
self.__class__ = new_node.__class__ # YOLO
self.__init__(new_node.fst(), parent=self.parent, on_attribute=self.on_attribute)

def rename(self, new_value):
if self.type in ('def', 'class'):
setattr(self, 'name', new_value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can directly do self.name = new_value here, same for line 1028.

Copy link
Contributor Author

@b5y b5y Aug 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In first time I thought about this solution, but this attribute is outside of init method.
So, I think it is not correct way. Please fix me if I am wrong.

@b5y b5y changed the title Add rename method. Add rename method from TODO list Aug 20, 2016
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.

2 participants