Return STK metadata from UIC tags as dict.
323776
def stk_metadata(self):
        """"""
        if not self.is_stk:
            return None
        page = self.pages[0]
        tags = page.tags
        result = {}
        result['NumberPlanes'] = tags['UIC2tag'].count
        if page.description:
            result['PlaneDescriptions'] = page.description.split('\0')
            # result['plane_descriptions'] = stk_description_metadata(
            #    page.image_description)
        if 'UIC1tag' in tags:
            result.update(tags['UIC1tag'].value)
        if 'UIC3tag' in tags:
            result.update(tags['UIC3tag'].value)  # wavelengths
        if 'UIC4tag' in tags:
            result.update(tags['UIC4tag'].value)  # override uic1 tags
        uic2tag = tags['UIC2tag'].value
        result['ZDistance'] = uic2tag['ZDistance']
        result['TimeCreated'] = uic2tag['TimeCreated']
        result['TimeModified'] = uic2tag['TimeModified']
        try:
            result['DatetimeCreated'] = numpy.array(
                [julian_datetime(*dt) for dt in
                 zip(uic2tag['DateCreated'], uic2tag['TimeCreated'])],
                dtype='datetime64[ns]')
            result['DatetimeModified'] = numpy.array(
                [julian_datetime(*dt) for dt in
                 zip(uic2tag['DateModified'], uic2tag['TimeModified'])],
                dtype='datetime64[ns]')
        except ValueError as exc:
            log.warning('STK metadata: %s: %s', exc.__class__.__name__, exc)
        return result
905856
def _return_metadata():
    
    app = current_app
    retdict = {"auth": app.config["AUTH"]["type"]}
    for fld in ["name", "repository", "version", "description",
                "api_version"]:
        retdict[fld] = app.config[fld.upper()]
    return jsonify(retdict)
289221
def _GetMetadataForClients(self, client_urns):
    """"""

    result = {}
    metadata_to_fetch = set()

    for urn in client_urns:
      try:
        result[urn] = self._cached_metadata[urn]
      except KeyError:
        metadata_to_fetch.add(urn)

    if metadata_to_fetch:
      if data_store.RelationalDBEnabled():
        client_ids = set(urn.Basename() for urn in metadata_to_fetch)
        infos = data_store.REL_DB.MultiReadClientFullInfo(client_ids)

        fetched_metadata = [
            export.GetMetadata(client_id, info)
            for client_id, info in infos.items()
        ]
      else:
        client_fds = aff4.FACTORY.MultiOpen(
            metadata_to_fetch, mode="r", token=self.token)

        fetched_metadata = [
            export.GetMetadataLegacy(client_fd, token=self.token)
            for client_fd in client_fds
        ]

      for metadata in fetched_metadata:
        metadata.source_urn = self.source_urn

        self._cached_metadata[metadata.client_urn] = metadata
        result[metadata.client_urn] = metadata
        metadata_to_fetch.remove(metadata.client_urn)

      for urn in metadata_to_fetch:
        default_mdata = export.ExportedMetadata(source_urn=self.source_urn)
        result[urn] = default_mdata
        self._cached_metadata[urn] = default_mdata

    return [result[urn] for urn in client_urns]
843569
def tag_dict(obj, *args, **kwargs):
    """"""

    if isinstance(obj, OrderedDict):
        return _TaggedOrderedDict(obj, *args, **kwargs)
    else:
        return _TaggedPlainDict(obj, *args, **kwargs)
187884
def read_mm_uic1(fd, byte_order, dtype, count):
    """"""
    t = fd.read(8*count)
    t = struct.unpack('%s%iI' % (byte_order, 2*count), t)
    return dict((MM_TAG_IDS[k], v) for k, v in zip(t[::2], t[1::2])
                if k in MM_TAG_IDS)
1238194
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'log_messages') and self.log_messages is not None:
            _dict['log_messages'] = [x._to_dict() for x in self.log_messages]
        if hasattr(self, 'text') and self.text is not None:
            _dict['text'] = self.text
        if hasattr(self, 'generic') and self.generic is not None:
            _dict['generic'] = [x._to_dict() for x in self.generic]
        if hasattr(self, 'nodes_visited') and self.nodes_visited is not None:
            _dict['nodes_visited'] = self.nodes_visited
        if hasattr(self, 'nodes_visited_details'
                  ) and self.nodes_visited_details is not None:
            _dict['nodes_visited_details'] = [
                x._to_dict() for x in self.nodes_visited_details
            ]
        if hasattr(self, '_additionalProperties'):
            for _key in self._additionalProperties:
                _value = getattr(self, _key, None)
                if _value is not None:
                    _dict[_key] = _value
        return _dict
1341457
def get_as_datadict(self):
        
        return dict(type=self.__class__.__name__, tags=list(self.tags))
1331653
def get_metadata(bind):
    """"""
    if bind == '':
        bind = None
    m = MetaData()
    for t in target_metadata.tables.values():
        if t.info.get('bind_key') == bind:
            t.tometadata(m)
    return m
807628
def to_dict(self):
        """"""
        d = Field.to_dict(self)
        if self.display_international:
            d['display_international'] = self.display_international
        return d
293407
def get_metadata():
    
    misc_path = pkg_resources.resource_filename('hwrt', 'misc/')
    wm_symbols = os.path.join(misc_path, 'wm_symbols.csv')
    wm_tags = os.path.join(misc_path, 'wm_tags.csv')
    wm_tags2symbols = os.path.join(misc_path, 'wm_tags2symbols.csv')
    return {'symbols': read_csv(wm_symbols),
            'tags': read_csv(wm_tags),
            'tags2symbols': read_csv(wm_tags2symbols)}
871975
def get_labels(self, field):
        """"""
        return {c: self.cluster_meta.get(field, c)
                for c in self.clustering.cluster_ids}
148004
def attrs(self):
        
        return dict((k, v) for k, v in iteritems(self.__dict__) if k is not "sdk")
1300794
def parse_metadata(self):
        """"""

        all_models = defaultdict(list)

        with open(self.metadata_index_json) as f:
            loaded = json.load(f)

        for m in loaded['index']:
            all_models[m['uniprot_ac']].append(m)

        self.all_models = dict(all_models)
1228812
def extract_function_metadata(wrapped, instance, args, kwargs, return_value):
    """"""
    LOGGER.debug(
        'Extracting function call metadata',
        args=args,
        kwargs=kwargs,
    )
    return {
        'metadata': {
            'args': args,
            'kwargs': kwargs,
        },
    }
1165318
def get_k8s_metadata():
    """"""
    k8s_metadata = {}

    gcp_cluster = (gcp_metadata_config.GcpMetadataConfig
                   .get_attribute(gcp_metadata_config.CLUSTER_NAME_KEY))
    if gcp_cluster is not None:
        k8s_metadata[CLUSTER_NAME_KEY] = gcp_cluster

    for attribute_key, attribute_env in _K8S_ENV_ATTRIBUTES.items():
        attribute_value = os.environ.get(attribute_env)
        if attribute_value is not None:
            k8s_metadata[attribute_key] = attribute_value

    return k8s_metadata
1241787
def to_dict(self):
        """"""
        result = {
            'type': get_qualified_name(self),
            'fitted': self.fitted,
            'constant_value': self.constant_value
        }

        if not self.fitted:
            return result

        result.update(self._fit_params())
        return result
931053
def dict_key_tag(Class, key, namespaces=None):
        """"""
        namespaces = namespaces or Class.NS
        ns = Class.tag_namespace(key)
        tag = Class.tag_name(key)
        if ns is None and ':' in key:
            prefix, tag = key.split(':')
            if prefix in namespaces.keys():
                ns = namespaces[prefix]
        if ns is not None:
            tag = "{%s}%s" % (ns, tag)
        return tag