diff --git a/redbaron/base_nodes.py b/redbaron/base_nodes.py index ff63540b..4ff7852f 100644 --- a/redbaron/base_nodes.py +++ b/redbaron/base_nodes.py @@ -134,7 +134,7 @@ def get_holder_on_attribute(class_, node): return to_return -class LiteralyEvaluable(object): +class LiterallyEvaluable(object): def to_python(self): try: return ast.literal_eval(self.dumps().strip()) @@ -505,7 +505,7 @@ def from_fst(klass, node, parent=None, on_attribute=None): @property def next(self): - in_list = self._get_list_attribute_is_member_off() + in_list = self._get_list_attribute_is_member_of() if in_list is None: return None @@ -545,7 +545,7 @@ def next_recursive(self): return target.next def next_generator(self): - in_list = self._get_list_attribute_is_member_off() + in_list = self._get_list_attribute_is_member_of() if in_list is None: return None @@ -556,7 +556,7 @@ def next_generator(self): @property def previous(self): - in_list = self._get_list_attribute_is_member_off() + in_list = self._get_list_attribute_is_member_of() if in_list is None: return None @@ -609,7 +609,7 @@ def previous_recursive(self): return target.previous def previous_generator(self): - in_list = self._get_list_attribute_is_member_off() + in_list = self._get_list_attribute_is_member_of() if in_list is None: return None @@ -642,7 +642,7 @@ def indentation_node_is_direct(self): return False - def _get_list_attribute_is_member_off(self): + def _get_list_attribute_is_member_of(self): """ Return the list attribute of the parent from which this node is a member. diff --git a/redbaron/nodes.py b/redbaron/nodes.py index ffef00c6..7f7d20da 100644 --- a/redbaron/nodes.py +++ b/redbaron/nodes.py @@ -5,7 +5,7 @@ import baron from baron.utils import string_instance -from redbaron.base_nodes import Node, NodeList, LiteralyEvaluable, CodeBlockNode, DotProxyList, CommaProxyList, LineProxyList, IfElseBlockSiblingNode, ElseAttributeNode +from redbaron.base_nodes import Node, NodeList, LiterallyEvaluable, CodeBlockNode, DotProxyList, CommaProxyList, LineProxyList, IfElseBlockSiblingNode, ElseAttributeNode from redbaron.syntax_highlight import python_html_highlight @@ -91,7 +91,7 @@ def __setattr__(self, key, value): setattr(self, "value", DotProxyList(self.value)) -class BinaryNode(Node, LiteralyEvaluable): +class BinaryNode(Node, LiterallyEvaluable): def __setattr__(self, key, value): if key == "value" and isinstance(value, string_instance): assert baron.parse(value)[0]["type"] == "binary" @@ -117,11 +117,11 @@ def _string_to_node(self, string, parent, on_attribute): raise Exception("Unhandled case") -class BinaryStringNode(Node, LiteralyEvaluable): +class BinaryStringNode(Node, LiterallyEvaluable): pass -class BinaryRawStringNode(Node, LiteralyEvaluable): +class BinaryRawStringNode(Node, LiterallyEvaluable): pass @@ -322,7 +322,7 @@ def _string_to_node(self, string, parent, on_attribute): raise Exception("Unhandled case") -class DictNode(Node, LiteralyEvaluable): +class DictNode(Node, LiterallyEvaluable): def _string_to_node_list(self, string, parent, on_attribute): fst = baron.parse("{%s}" % string)[0]["value"] return NodeList.from_fst(fst, parent=parent, on_attribute=on_attribute) @@ -567,15 +567,15 @@ def _string_to_node(self, string, parent, on_attribute): return super(ForNode, self)._string_to_node(string, parent, on_attribute) -class FloatNode(Node, LiteralyEvaluable): +class FloatNode(Node, LiterallyEvaluable): pass -class FloatExponantNode(Node, LiteralyEvaluable): +class FloatExponantNode(Node, LiterallyEvaluable): pass -class FloatExponantComplexNode(Node, LiteralyEvaluable): +class FloatExponantComplexNode(Node, LiterallyEvaluable): pass @@ -695,7 +695,7 @@ def __setattr__(self, key, value): setattr(self, "value", CommaProxyList(self.value, on_attribute="value")) -class HexaNode(Node, LiteralyEvaluable): +class HexaNode(Node, LiterallyEvaluable): pass @@ -757,7 +757,7 @@ def __setattr__(self, key, value): setattr(self, "value", CommaProxyList(self.value, on_attribute="value")) -class IntNode(Node, LiteralyEvaluable): +class IntNode(Node, LiterallyEvaluable): def fst(self): return { "type": "int", @@ -820,7 +820,7 @@ def _string_to_node(self, string, parent, on_attribute): raise Exception("Unhandled case") -class ListNode(Node, LiteralyEvaluable): +class ListNode(Node, LiterallyEvaluable): def _string_to_node_list(self, string, parent, on_attribute): fst = baron.parse("[%s]" % string)[0]["value"] return NodeList.from_fst(fst, parent=parent, on_attribute=on_attribute) @@ -832,11 +832,11 @@ def __setattr__(self, key, value): setattr(self, "value", CommaProxyList(self.value)) -class LongNode(Node, LiteralyEvaluable): +class LongNode(Node, LiterallyEvaluable): pass -class NameNode(Node, LiteralyEvaluable): +class NameNode(Node, LiterallyEvaluable): pass @@ -857,7 +857,7 @@ def __setattr__(self, key, value): return super(NameAsNameNode, self).__setattr__(key, value) -class OctaNode(Node, LiteralyEvaluable): +class OctaNode(Node, LiterallyEvaluable): pass @@ -938,7 +938,7 @@ def _string_to_node(self, string, parent, on_attribute): raise Exception("Unhandled case") -class RawStringNode(Node, LiteralyEvaluable): +class RawStringNode(Node, LiterallyEvaluable): pass @@ -1030,11 +1030,11 @@ class StarNode(Node): pass -class StringNode(Node, LiteralyEvaluable): +class StringNode(Node, LiterallyEvaluable): pass -class StringChainNode(Node, LiteralyEvaluable): +class StringChainNode(Node, LiterallyEvaluable): def _string_to_node_list(self, string, parent, on_attribute): if on_attribute == "value": fst = baron.parse("a = %s" % string)[0]["value"]["value"] @@ -1127,7 +1127,7 @@ def __getattr__(self, name): return super(TryNode, self).__getattr__(name) -class TupleNode(Node, LiteralyEvaluable): +class TupleNode(Node, LiterallyEvaluable): def _string_to_node_list(self, string, parent, on_attribute): fst = baron.parse("(%s)" % string)[0]["value"] @@ -1145,11 +1145,11 @@ def __setattr__(self, key, value): setattr(self, "value", CommaProxyList(self.value)) -class UnicodeStringNode(Node, LiteralyEvaluable): +class UnicodeStringNode(Node, LiterallyEvaluable): pass -class UnicodeRawStringNode(Node, LiteralyEvaluable): +class UnicodeRawStringNode(Node, LiterallyEvaluable): pass