Extend metadata for tables or views
        :param data: list of (rel_name, ) tuples
        :param kind: either 'tables' or 'views'
        :return:
967516
def extend_relations(self, data, kind):
        
        # 'data' is a generator object. It can throw an exception while being
        # consumed. This could happen if the user has launched the app without
        # specifying a database name. This exception must be handled to prevent
        # crashing.
        try:
            data = [self.escaped_names(d) for d in data]
        except Exception:
            data = []

        # dbmetadata['tables'][$schema_name][$table_name] should be a list of
        # column names. Default to an asterisk
        metadata = self.dbmetadata[kind]
        for relname in data:
            try:
                metadata[self.dbname][relname[0]] = ['*']
            except KeyError:
                _logger.error('%r %r listed in unrecognized schema %r',
                              kind, relname[0], self.dbname)
            self.all_completions.add(relname[0])
79049
def CreateDataTypeMapByType(cls, data_type_definition):
    
    data_type_map_class = cls._MAP_PER_DEFINITION.get(
        data_type_definition.TYPE_INDICATOR, None)
    if not data_type_map_class:
      return None

    return data_type_map_class(data_type_definition)
952289
function(new_data, original_data) {
        var key;
        for (key in new_data) {
            if (new_data[key].constructor === Object) {
                original_data[key] = this._recursive_extend(
                    new_data[key],
                    original_data[key]
                );
            } else {
                original_data[key] = new_data[key];
            }
        }
        return original_data;
    }
889260
def parse(self, type, data):
        
        try:
            return self.registered_formats[type]['parser'](data)
        except KeyError:
            raise NotImplementedError("No parser found for "
                                      "type '{type}'".format(type=type))
21596
def usable_item(self, data):
        

        # Use metadata as item
        item = data['meta']

        # Add nested IO for data
        elems, elems_is_complex = self.getlist('parameter')
        if elems_is_complex:
            elems = [elem['name'] for elem in elems]

        add, add_is_complex = self.getlist('add')
        item['data'] = DataIO(
            data=data['data'],
            parameter=elems,
            add=add,
            start_date=self.getvalue('start_date'),
            end_date=self.getvalue('end_date'),
        )

        # TupleMapper will convert item to namedtuple
        return super(StationDataIO, self).usable_item(item)
1072724
def load_metadata(self, data_dir, feature_name=None):
    """"""
    # Restore names if defined
    filepath = _get_metadata_filepath(data_dir, feature_name)
    if tf.io.gfile.exists(filepath):
      with tf.io.gfile.GFile(filepath, 'r') as f:
        info_data = json.load(f)
      self.set_encoding_format(info_data['encoding_format'])
      self.set_shape([None if d == -1 else d for d in info_data['shape']])
748171
function prepareEPUBDataForIndexing(metaData, data) {
    if(!metaData.spineItems.length) {
        return;
    }

    if (!data.FirstSpineItemsId) {
        data.FirstSpineItemsId = [];
    }

    data.FirstSpineItemsId.push(
        metaData.spineItems[0].id + ':' + metaData.title
    );

    metaData.spineItems.forEach( spineItem => {
        const spineItemPath = metaData.manifestPath + '/' + spineItem.href;
        const json = htmlToJSON(spineItemPath);
        setMetaData(json, metaData, spineItem);
        data.push(json);
    });
}
1373669
function addData (db, mime, source) {
  Object.keys(mime).forEach(function (key) {
    var data = mime[key]
    var type = key.toLowerCase()
    var obj = db[type] = db[type] || createTypeEntry(source)

    // add missing data
    setValue(obj, 'charset', data.charset)
    setValue(obj, 'compressible', data.compressible)

    // append new extensions
    appendExtensions(obj, data.extensions)
  })
}
1122395
def add_properties(self, names, methods):
        
        cls = type(self)
        cls = type(cls.__name__, (cls,), dict(cls.__dict__))
        if isinstance(names, string_types):
            names = [names]
            methods = [methods]
        for name,method in zip(names, methods):
            setattr(cls, name, property(method))
        return self.view(type=cls)
1079326
def visit_Metadata(self, metadata, *args, **kwargs):
        """"""
        result = OrderedDict()
        put_scalar = lambda name, json_name=None: self.optional_attribute_scalar(result, metadata, name, json_name)
        put_list = lambda name, json_name=None: self.optional_attribute_list(result, metadata, name, json_name)

        put_scalar('name')
        put_scalar('description')
        put_scalar('author')
        put_scalar('copyright')
        put_list('links')
        put_scalar('time')
        put_scalar('keywords')
        put_scalar('bounds')
        put_list('extensions')

        return result
1201293
def load(self, data):
        
        objs = {}
        for mapper in self.entities:
            objs[mapper.name] = mapper.load(self.loader, data)

        for mapper in self.relations:
            objs[mapper.name] = mapper.load(self.loader, data, objs)
874905
def relations_of_type(reltype=None):
    """"""
    relation_data = []
    reltype = reltype or relation_type()
    for relid in relation_ids(reltype):
        for relation in relations_for_id(relid):
            relation['__relid__'] = relid
            relation_data.append(relation)
    return relation_data
802646
def _maybe_dt_data(data, feature_names, feature_types):
    
    if not isinstance(data, DataTable):
        return data, feature_names, feature_types

    data_types_names = tuple(lt.name for lt in data.ltypes)
    bad_fields = [data.names[i]
                  for i, type_name in enumerate(data_types_names)
                  if type_name not in DT_TYPE_MAPPER]
    if bad_fields:
        msg = """DataFrame.types for data must be int, float or bool.
                Did not expect the data types in fields """
        raise ValueError(msg + ', '.join(bad_fields))

    if feature_names is None:
        feature_names = data.names

        # always return stypes for dt ingestion
        if feature_types is not None:
            raise ValueError('DataTable has own feature types, cannot pass them in')
        feature_types = np.vectorize(DT_TYPE_MAPPER2.get)(data_types_names)

    return data, feature_names, feature_types
1362385
def convert_table(self, table_name, cls_att=None):
        '''
        
        '''
        import Orange

        cols = self.db.cols[table_name]
        attributes, metas, class_var = [], [], None
        for col in cols:
            att_type = self.orng_type(table_name, col)
            if att_type == 'd':
                att_vals = self.db.col_vals[table_name][col]
                att_var = Orange.data.DiscreteVariable(str(col), values=[str(val) for val in att_vals])
            elif att_type == 'c':
                att_var = Orange.data.ContinuousVariable(str(col))
            else:
                att_var = Orange.data.StringVariable(str(col))
            if col == cls_att:
                if att_type == 'string':
                    raise Exception('Unsuitable data type for a target variable: %s' % att_type)
                class_var = att_var
                continue
            elif att_type == 'string' or table_name in self.db.pkeys and col in self.db.pkeys[
                table_name] or table_name in self.db.fkeys and col in self.db.fkeys[table_name]:
                metas.append(att_var)
            else:
                attributes.append(att_var)
        domain = Orange.data.Domain(attributes, class_vars=class_var, metas=metas)
        # for meta in metas:
        #    domain.addmeta(Orange.newmetaid(), meta)
        dataset = Orange.data.Table(domain)
        dataset.name = table_name
        for row in self.db.rows(table_name, cols):
            example = Orange.data.Instance(domain)
            for col, val in zip(cols, row):
                example[str(col)] = str(val) if val != None else '?'
            dataset.append(example)
        return dataset
744720
def determine_metadata(self, request, view):
        """"""
        metadata = super(
            DynamicMetadata,
            self).determine_metadata(
            request,
            view)
        metadata['features'] = getattr(view, 'features', [])
        if hasattr(view, 'get_serializer'):
            serializer = view.get_serializer(dynamic=False)
            if hasattr(serializer, 'get_name'):
                metadata['resource_name'] = serializer.get_name()
            if hasattr(serializer, 'get_plural_name'):
                metadata['resource_name_plural'] = serializer.get_plural_name()
        metadata['properties'] = self.get_serializer_info(serializer)
        return metadata
160407
public void append(SimpleTypeInformation<?> meta, Object data) {
    this.meta.add(meta);
    this.contents.add(data);
  }
38175
def external_metadata(self, datasource_type=None, datasource_id=None):
        """"""
        if datasource_type == 'druid':
            datasource = ConnectorRegistry.get_datasource(
                datasource_type, datasource_id, db.session)
        elif datasource_type == 'table':
            database = (
                db.session
                .query(Database)
                .filter_by(id=request.args.get('db_id'))
                .one()
            )
            Table = ConnectorRegistry.sources['table']
            datasource = Table(
                database=database,
                table_name=request.args.get('table_name'),
                schema=request.args.get('schema') or None,
            )
        external_metadata = datasource.external_metadata()
        return self.json_response(external_metadata)