def import_from_path(full_path, is_package=False): # print "\n\n\nNOTE: %r\n\n\n" % full_path name = getmodulename(full_path) if full_path in import_table: # print "IMPORTING CACHE %r: %r" % (name, full_path) res = import_table[full_path] else: # print "IMPORTING NEW %r: %r" % (name, full_path) if TypeModule.module_in_stack(full_path): # #print"GOT IT IN IMPORTED_STACK" return { "types": create_unknown("types"), "values": create_empty_value() } if is_package: res = TypePackage.from_code(full_path) else: res = TypeModule.from_code(full_path) res_vtype = { "types": create_empty("types"), "values": create_empty_value() } res_vtype["types"].add_typeobj(res) return res_vtype
def from_code(path): path = getabspath(path) module_name = getmodulename(path) init_path = os.path.join(path, "__init__.py") # print "IMPORTING PACKAGE %r" % path if os.path.exists(init_path): # print "FOUND INIT %r" % init_path module_name = getmodulename(init_path) res = TypePackage(cfg_wrapper.import_module(init_path), module_name, path) prev_state = _state TypeCallable._set_state(RootState) res.call("types", 0) res._set_attrs() TypeCallable._set_state(prev_state) else: res = TypePackage(None, module_name, path) import_table[path] = res return res
def from_code(path): path = getabspath(path) module_name = getmodulename(path) init_path = os.path.join(path, '__init__.py') # print "IMPORTING PACKAGE %r" % path if os.path.exists(init_path): # print "FOUND INIT %r" % init_path module_name = getmodulename(init_path) res = TypePackage(cfg_wrapper.import_module(init_path), module_name, path) prev_state = _state TypeCallable._set_state(RootState) res.call("types", 0) res._set_attrs() TypeCallable._set_state(prev_state) else: res = TypePackage(None, module_name, path) import_table[path] = res return res
def from_code(path): path = getabspath(path) module_name = getmodulename(path) res = TypeModule(cfg_wrapper.import_module(path), module_name, path) prev_state = _state TypeCallable._set_state(RootState) res.call("types", 0) res._set_attrs() TypeCallable._set_state(prev_state) import_table[path] = res return res
def from_code(path): path = getabspath(path) module_name = getmodulename(path) res = TypeModule(cfg_wrapper.import_module(path), module_name, path) prev_state = _state TypeCallable._set_state(RootState) res.call("types", 0) res._set_attrs() TypeCallable._set_state(prev_state) import_table[path] = res return res
def import_from_path(full_path, is_package=False): # print "\n\n\nNOTE: %r\n\n\n" % full_path name = getmodulename(full_path) if full_path in import_table: # print "IMPORTING CACHE %r: %r" % (name, full_path) res = import_table[full_path] else: # print "IMPORTING NEW %r: %r" % (name, full_path) if TypeModule.module_in_stack(full_path): # #print"GOT IT IN IMPORTED_STACK" return {"types": create_unknown("types"), "values": create_empty_value()} if is_package: res = TypePackage.from_code(full_path) else: res = TypeModule.from_code(full_path) res_vtype = {"types": create_empty("types"), "values": create_empty_value()} res_vtype["types"].add_typeobj(res) return res_vtype