def _init_imports(self): body = sourceutils.get_body(self.pyfunction) body, imports = move.moving_code_with_imports( self.project, self.resource, body) self.imports = imports self.others_generator = _DefinitionGenerator( self.project, self.pyfunction, body=body)
def _init_imports(self): body = sourceutils.get_body(self.pyfunction) body, imports = move.moving_code_with_imports( self.pycore, self.resource, body) self.imports = imports self.others_generator = _DefinitionGenerator( self.project, self.pyfunction, body=body)
def _get_body(self): body = sourceutils.get_body(self.pyfunction) for param in self._get_parameter_names(): body = param + ' = None\n' + body pymod = self.pycore.get_string_module(body, self.resource) pyname = pymod[param] finder = occurrences.create_finder(self.pycore, param, pyname) result = rename.rename_in_module(finder, 'self.' + param, pymodule=pymod) body = result[result.index('\n') + 1:] return body
def __init__(self, project, pyfunction, body=None): self.pycore = project.pycore self.pyfunction = pyfunction self.pymodule = pyfunction.get_module() self.resource = self.pymodule.get_resource() self.definition_info = self._get_definition_info() self.definition_params = self._get_definition_params() self._calculated_definitions = {} if body is not None: self.body = body else: self.body = sourceutils.get_body(self.pyfunction)
def __init__(self, project, pyfunction, body=None): self.project = project self.pyfunction = pyfunction self.pymodule = pyfunction.get_module() self.resource = self.pymodule.get_resource() self.definition_info = self._get_definition_info() self.definition_params = self._get_definition_params() self._calculated_definitions = {} if body is not None: self.body = body else: self.body = sourceutils.get_body(self.pyfunction)
def _get_body(self): body = sourceutils.get_body(self.pyfunction) for param in self._get_parameter_names(): body = param + " = None\n" + body pymod = libutils.get_string_module(self.project, body, self.resource) pyname = pymod[param] finder = occurrences.create_finder(self.project, param, pyname) result = rename.rename_in_module(finder, "self." + param, pymodule=pymod) body = result[result.index("\n") + 1:] return body
print k, v.get_definition_location() print "\n" wrap = outMeths['wrap'] print dir(wrap.pyobject) print "\n" print wrap.pyobject.get_scope() outScope = out.pyobject.get_scope() print outScope print outScope.get_scopes() print outScope.end su = sourceutils print su.get_body_region(wrap.pyobject) print sourceutils.get_body(wrap.pyobject) import handy def dump(scope, depth=0): line = "%s%s:" % (obj.get_name, su.get_body_region(obj)) print handy.indent('# '*depth, line)
def _get_body(self): return sourceutils.get_body(self.pyfunction)
print k, v.get_definition_location() print "\n" wrap = outMeths['wrap'] print dir(wrap.pyobject) print "\n" print wrap.pyobject.get_scope() outScope = out.pyobject.get_scope() print outScope print outScope.get_scopes() print outScope.end su = sourceutils print su.get_body_region(wrap.pyobject) print sourceutils.get_body(wrap.pyobject) import handy def dump(scope, depth=0): line = "%s%s:" % (obj.get_name, su.get_body_region(obj)) print handy.indent('# ' * depth, line) scope = obj.get_scope() for scope in gl.get_scope().get_scopes(): pyo = scope.pyobject dump(pyo) print ">>>", pyo.get_type()