def load_node(node, file_path):
path_var = "node.%s"%node
main_module = imp.load_source(path_var, file_path)
for c in main_module.__dict__.values():
try:
if issubclass(c, Node) and c.__module__ is main_module.__name__:
nodes[node] = c
if c.char and isinstance(c.char, str):
c.char = bytearray([ord(c.char[-1].encode()) | (0x80 * (len(c.char) == 2))])
elif isinstance(c.char, bytes):
c.char = bytearray(c.char)
c.ignore_dot = True
elif c.char == "":
c.char = b""
return c
except TypeError:
pass
评论列表
文章目录