MCPcopy
hub / github.com/lutzroeder/netron / resolve

Method resolve

source/python.js:21932–21962  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

21930 }
21931
21932 resolve(name) {
21933 const index = name.lastIndexOf('.');
21934 const memberName = index === -1 ? name : name.substring(index + 1, name.length);
21935 const moduleName = index === -1 ? '' : name.substring(0, index);
21936 const module = this.import(moduleName);
21937 let type = module ? module[memberName] : null;
21938 if (!type) {
21939 const index = name.indexOf('.');
21940 const rootName = index === -1 ? '' : name.substring(0, index);
21941 if (rootName) {
21942 const root = this.import(rootName);
21943 if (root && root.__materialize__) {
21944 root.__materialize__(name);
21945 const module = this.import(moduleName);
21946 type = module ? module[memberName] : null;
21947 }
21948 }
21949 }
21950 if (!type) {
21951 if (!this._unresolved.has(name)) {
21952 const moduleName = name.split('.').shift();
21953 if (this._registry.has(moduleName) && moduleName !== '__main__' && moduleName !== '__torch__') {
21954 this.emit('resolve', name);
21955 }
21956 const type = this._createType(name, class {});
21957 this._unresolved.set(name, type);
21958 }
21959 type = this._unresolved.get(name);
21960 }
21961 return type;
21962 }
21963
21964 invoke(target, args) {
21965 const builtins = this.builtins;

Callers 5

find_classMethod · 0.45
constructorMethod · 0.45
LEGACY_deserializeMethod · 0.45
invokeMethod · 0.45
targetMethod · 0.45

Calls 7

splitMethod · 0.80
_createTypeMethod · 0.80
importMethod · 0.45
hasMethod · 0.45
emitMethod · 0.45
setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected