|
|
@@ -588,32 +588,32 @@ sklearn.Metadata = class {
|
|
|
}
|
|
|
|
|
|
constructor(data) {
|
|
|
- this._map = new Map();
|
|
|
- this._attributeCache = new Map();
|
|
|
+ this._types = new Map();
|
|
|
+ this._attributes = new Map();
|
|
|
if (data) {
|
|
|
const metadata = JSON.parse(data);
|
|
|
- this._map = new Map(metadata.map((item) => [ item.name, item ]));
|
|
|
+ this._types = new Map(metadata.map((item) => [ item.name, item ]));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
type(name) {
|
|
|
- return this._map.get(name);
|
|
|
+ return this._types.get(name);
|
|
|
}
|
|
|
|
|
|
attribute(type, name) {
|
|
|
const key = type + ':' + name;
|
|
|
- if (!this._attributeCache.has(key)) {
|
|
|
+ if (!this._attributes.has(key)) {
|
|
|
const schema = this.type(type);
|
|
|
if (schema && schema.attributes && schema.attributes.length > 0) {
|
|
|
for (const attribute of schema.attributes) {
|
|
|
- this._attributeCache.set(type + ':' + attribute.name, attribute);
|
|
|
+ this._attributes.set(type + ':' + attribute.name, attribute);
|
|
|
}
|
|
|
}
|
|
|
- if (!this._attributeCache.has(key)) {
|
|
|
- this._attributeCache.set(key, null);
|
|
|
+ if (!this._attributes.has(key)) {
|
|
|
+ this._attributes.set(key, null);
|
|
|
}
|
|
|
}
|
|
|
- return this._attributeCache.get(key);
|
|
|
+ return this._attributes.get(key);
|
|
|
}
|
|
|
};
|
|
|
|