def add_parameter_access(self): name = 'ParameterAccess' t = 'class %s(object):\n' % (name, ) for detail in get_all_details(): t += ' def %s(self): pass\n' % (detail.key, ) nodes = self.builder.string_build(t) self.module.locals[name] = nodes.locals[name]
def add_parameter_access(self, module): # def DEFAULT_SALES_CFOP(): pass # ParameterAccess.DEFAULT_SALES_CFOP = DEFAULT_SALES_CFOP # etc ParameterAccess = self.module.locals['ParameterAccess'][0] for detail in get_all_details(): func = build_function(detail.key) # FIXME: We should use ParameterAccess.add_local_node, # to add the function at the right place in the ast, # but it breaks for some reasons func.parent = ParameterAccess ParameterAccess.set_local(detail.key, func)