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

Method constructor

source/python.js:8–21782  ·  view source on GitHub ↗
(sources)

Source from the content-addressed store, hash-verified

6python.Execution = class {
7
8 constructor(sources) {
9 /* eslint-disable consistent-this */
10 const self = this;
11 /* eslint-enable consistent-this */
12 const execution = self;
13 this._sources = sources || new Map();
14 this._events = new Map();
15 this._utf8Decoder = new TextDecoder('utf-8');
16 this._unresolved = new Map();
17 this._operators = new Map();
18 const dict = class extends Map {
19 constructor(items) {
20 super();
21 if (items) {
22 if (items instanceof Map) {
23 items = Array.from(items);
24 } else if (!Array.isArray(items)) {
25 items = Object.entries(items);
26 }
27 for (const [name, value] of items) {
28 this.__setitem__(name, value);
29 }
30 }
31 }
32 __contains__(key) {
33 return this.has(key);
34 }
35 __setitem__(key, value) {
36 this.set(key, value);
37 }
38 __getitem__(key) {
39 if (!super.has(key)) {
40 throw new python.Error(`KeyError: ${key}`);
41 }
42 return super.get(key);
43 }
44 __delitem__(key) {
45 this.delete(key);
46 }
47 get(key, defaultValue) {
48 return super.has(key) ? super.get(key) : defaultValue;
49 }
50 setdefault(key, defaultValue) {
51 if (this.has(key)) {
52 return this.get(key);
53 }
54 const value = defaultValue || null;
55 this.set(key, value);
56 return value;
57 }
58 pop(key) {
59 if (this.__contains__(key)) {
60 const v = this.__getitem__(key);
61 this.__delitem__(key);
62 return v;
63 }
64 return null;
65 }

Callers

nothing calls this directly

Calls 15

ObjectClass · 0.85
registerTypeMethod · 0.80
registerFunctionMethod · 0.80
mapMethod · 0.80
__import__Method · 0.80
__new__Method · 0.80
__contains__Method · 0.80
hasattrMethod · 0.80
__getattr__Method · 0.80
__setattr__Method · 0.80
setdefaultMethod · 0.80
itemsMethod · 0.80

Tested by

no test coverage detected