Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions redbaron/base_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
40 changes: 20 additions & 20 deletions redbaron/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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"
Expand All @@ -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


Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand All @@ -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


Expand All @@ -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


Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -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"]

Expand All @@ -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


Expand Down