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

Method register

source/python.js:22434–22455  ·  view source on GitHub ↗
(name, value)

Source from the content-addressed store, hash-verified

22432 }
22433
22434 register(name, value) {
22435 if (!this._registry.has(name)) {
22436 value = value || new (this._registry.get('builtins').module)(name);
22437 this._registry.set(name, value);
22438 let current = name;
22439 for (;;) {
22440 const index = current.lastIndexOf('.');
22441 if (index === -1) {
22442 break;
22443 }
22444 const child = current.substring(index + 1);
22445 current = current.substring(0, index);
22446 if (!value.__module__) {
22447 value.__module__ = current;
22448 }
22449 const parent = this.register(current);
22450 parent[child] = value;
22451 value = parent;
22452 }
22453 }
22454 return this._registry.get(name);
22455 }
22456
22457 registerFunction(name, value) {
22458 const builtins = this.builtins;

Callers 3

constructorMethod · 0.45
registerFunctionMethod · 0.45
registerTypeMethod · 0.45

Calls 3

hasMethod · 0.45
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected