Skip to content

Commit

Permalink
A temporary fix for the issue reported at RedBaron, PyCQA#192
Browse files Browse the repository at this point in the history
Parsing error when a class defined with metaclass keyword

Detailed discussion in grandfoosier/EMUresearch.
  • Loading branch information
sjiang1 committed Oct 3, 2019
1 parent d225ead commit 6168970
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions redbaron/base_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,15 @@ def __init__(self, initlist=None, parent=None, on_attribute=None):

@classmethod
def from_fst(klass, node_list, parent=None, on_attribute=None):
return klass(map(lambda x: Node.from_fst(x, parent=parent, on_attribute=on_attribute), node_list),
parent=parent, on_attribute=on_attribute)
# return klass(map(lambda x: Node.from_fst(x, parent=parent, on_attribute=on_attribute), node_list),
# parent=parent, on_attribute=on_attribute)
try:
return klass(map(lambda x: Node.from_fst(x, parent=parent, on_attribute=on_attribute), node_list),
parent=parent, on_attribute=on_attribute)
except:
return klass(map(lambda x: Node.from_fst(x, parent=parent, on_attribute=on_attribute), node_list[0]),
parent=parent, on_attribute=on_attribute)


def find(self, identifier, *args, **kwargs):
for i in self.data:
Expand Down

0 comments on commit 6168970

Please sign in to comment.