-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
base: master
Are you sure you want to change the base?
Conversation
@@ -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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
… into feature/rename_method # Conflicts: # TODO.md # redbaron/base_nodes.py
Add rename method with tests. Remove task from TODO list. Update CHANGELOG.