def set(self, tree): from pyntch.syntax import build_stmt from pyntch.config import ErrorConfig from pyntch.exception import ImportErrorType self.space.register_names_top(tree) build_stmt(self, self.frame, self.space, tree, [], isfuncdef=True) return
def __init__(self, parent_reporter, parent_frame, parent_space, anchor, name, bases, evals, tree): from pyntch.syntax import build_stmt self.anchor = anchor self.loc = (tree._module, tree.lineno) self.space = Namespace(parent_space, name) TreeReporter.__init__(self, parent_reporter) ClassType.__init__(self, name, bases) if tree.code: self.space.register_names(tree.code) build_stmt(self, parent_frame, self.space, tree.code, evals, parent_space=parent_space) for (name,var) in self.space: # Do not consider the values of attributes inherited from the base class # if they are explicitly overriden. attr = self.ClassAttr(parent_frame, anchor, name, self) var.connect(attr.recv) self.attrs[name] = attr return
def build_evals(self, code): from pyntch.syntax import build_stmt evals = [] build_stmt(self, self.frame, self.space, code, evals, isfuncdef=True) return evals