You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from abc import ABCMeta, abstractmethod
class Employee(metaclass=ABCMeta):
pass
The test case:
from redbaron import RedBaron
with open("test3.py", "r") as source_code:
red = RedBaron(source_code.read())
Error message:
Traceback (most recent call last):
File "demo.py", line 6, in <module>
red = RedBaron(source_code.read())
File "../redbaron/redbaron/redbaron.py", line 36, in __init__
self.node_list = base_nodes.NodeList.from_fst(baron.parse(source_code), parent=self, on_attribute="root")
File "../redbaron/redbaron/base_nodes.py", line 335, in from_fst
parent=parent, on_attribute=on_attribute)
File "../redbaron/redbaron/base_nodes.py", line 328, in __init__
super(NodeList, self).__init__(initlist)
File "/usr/lib/python3.6/collections/__init__.py", line 1039, in __init__
self.data = list(initlist)
File "../redbaron/redbaron/base_nodes.py", line 334, in <lambda>
return klass(map(lambda x: Node.from_fst(x, parent=parent, on_attribute=on_attribute), node_list),
File "../redbaron/redbaron/base_nodes.py", line 537, in from_fst
return getattr(redbaron.nodes, class_name)(node, parent=parent, on_attribute=on_attribute)
File "../redbaron/redbaron/base_nodes.py", line 526, in __init__
setattr(self, key, NodeList.from_fst(fst[key], parent=self, on_attribute=key))
File "../redbaron/redbaron/base_nodes.py", line 335, in from_fst
parent=parent, on_attribute=on_attribute)
File "../redbaron/redbaron/base_nodes.py", line 328, in __init__
super(NodeList, self).__init__(initlist)
File "/usr/lib/python3.6/collections/__init__.py", line 1039, in __init__
self.data = list(initlist)
File "../redbaron/redbaron/base_nodes.py", line 334, in <lambda>
return klass(map(lambda x: Node.from_fst(x, parent=parent, on_attribute=on_attribute), node_list),
File "../redbaron/redbaron/base_nodes.py", line 536, in from_fst
class_name = baron_type_to_redbaron_classname(node["type"])
TypeError: list indices must be integers or slices, not str
The text was updated successfully, but these errors were encountered:
sjiang1
changed the title
Parsing Error when a class defined with metaclass keyword
Parsing error when a class defined with metaclass keyword
Oct 3, 2019
sjiang1
added a commit
to sjiang1/redbaron
that referenced
this issue
Oct 3, 2019
The file, test3.py, being parsed:
The test case:
Error message:
The text was updated successfully, but these errors were encountered: