Check if encryption metadata exists in json metadata
        :param dict md: metadata dictionary
        :rtype: bool
        :return: if encryption metadata exists
188034
def encryption_metadata_exists(md):
        # type: (dict) -> bool
        
        try:
            if blobxfer.util.is_not_empty(
                    md[EncryptionMetadata._METADATA_KEY_NAME]):
                return True
        except (KeyError, TypeError):
            pass
        return False
462195
def _check_keys(dictionary):
    
    for key in dictionary:
        if isinstance(dictionary[key], matlab.mio5_params.mat_struct):
            dictionary[key] = _todict(dictionary[key])
    return dictionary
515112
def check_validity_for_dict(keys, dict):
    
    for key in keys:
        if key not in dict or dict[key] is '' or dict[key] is None:
            return False
    return True
1258238
def typelogged_module(md):
    
    if not pytypes.typelogging_enabled:
        return md
    if isinstance(md, str):
        if md in sys.modules:
            md = sys.modules[md]
            if md is None:
                return md
        elif md in pytypes.typechecker._pending_modules:
            # if import is pending, we just store this call for later
            pytypes.typechecker._pending_modules[md].append(typelogged_module)
            return md
    assert(ismodule(md))
    if md.__name__ in pytypes.typechecker._pending_modules:
            # if import is pending, we just store this call for later
            pytypes.typechecker._pending_modules[md.__name__].append(typelogged_module)
            # we already process the module now as far as possible for its internal use
            # todo: Issue warning here that not the whole module might be covered yet
    assert(ismodule(md))
    if md.__name__ in _fully_typelogged_modules and \
            _fully_typelogged_modules[md.__name__] == len(md.__dict__):
        return md
    # To play it safe we avoid to modify the dict while iterating over it,
    # so we previously cache keys.
    # For this we don't use keys() because of Python 3.
    # Todo: Better use inspect.getmembers here
    keys = [key for key in md.__dict__]
    for key in keys:
        memb = md.__dict__[key]
        if _check_as_func(memb) and memb.__module__ == md.__name__:
            setattr(md, key, typelogged_func(memb))
        elif isclass(memb) and memb.__module__ == md.__name__:
            typelogged_class(memb)
    if not md.__name__ in pytypes.typechecker._pending_modules:
        _fully_typelogged_modules[md.__name__] = len(md.__dict__)
    return md
459905
def get_asset_metadata(self, did):
        
        response = self.requests_session.get(f'{self._base_url}/metadata/{did}').content
        if not response:
            return {}
        try:
            parsed_response = json.loads(response)
        except TypeError:
            parsed_response = None
        except ValueError:
            raise ValueError(response.decode('UTF-8'))
        if parsed_response is None:
            return {}
        return parsed_response['metadata']
871913
def get_metadata(self, key) -> str:
        
        return self.metadata[key] if key in self.metadata else None
780065
function ParseMetaData(countryCode, md) {
    var array = eval(md.replace(BACKSLASH, "\\\\"));
    md = ParseArray(array,
                    META_DATA_ENCODING,
                    { countryCode: countryCode });
    regionCache[md.region] = md;
    return md;
  }
68857
def add_metadata_defaults(md):
    
    defaults = {"batch": None,
                "phenotype": ""}
    for k, v in defaults.items():
        if k not in md:
            md[k] = v
    return md
457211
def contains(self, key, counter_id):
        
        with self._lock:
            return counter_id in self._metadata[key]
917347
def update_metadata(self, bucket, label, params):
        '''
        '''
        if self.mode !="r":
            try:
                payload = self._get_bucket_md(bucket)
            except OFSFileNotFound:
                # No MD found... create it
                payload = {}
                for l in self.list_labels(bucket):
                    payload[l] = {}
                    payload[l]['_label'] = l
                if not self.quiet:
                    print("Had to create md file for %s" % bucket)
            except OFSException as e:
                raise OFSException(e)
            if not label in payload:
                payload[label] = {}
            payload[label].update(params)
            self.put_stream(bucket, MD_FILE, json.dumps(payload).encode('utf-8'), params={}, replace=True, add_md=False)
            return payload[label]
        else:
            raise OFSException("Cannot update MD in archive in 'r' mode")
189567
function hasKey(key) {
    return data.meta[key] !== undefined
      && (self.lookup[key] === null ||
      self.lookup[key] === data.meta[key]);
  }
111075
def _check_all_metadata_found(metadata, items):
    """"""
    for name in metadata:
        seen = False
        for sample in items:
            check_file = sample["files"][0] if sample.get("files") else sample["vrn_file"]
            if isinstance(name, (tuple, list)):
                if check_file.find(name[0]) > -1:
                    seen = True
            elif check_file.find(name) > -1:
                seen = True
            elif "*" in name and fnmatch.fnmatch(check_file, "*/%s" % name):
                seen = True
        if not seen:
            print("WARNING: sample not found %s" % str(name))
1032025
def exists(path, with_expected_db_version=None):
        
        dbmetafile = os.path.join(path, AnchoreImageDB._db_metadata_filename)

        if not os.path.exists(path) or not os.path.exists(dbmetafile):
            return False

        if with_expected_db_version:
            with open(dbmetafile, 'r') as f:
                json_dict = json.load(f)

            if json_dict['anchore_db_version'] != with_expected_db_version:
                return False
        else:
            return True
1065934
def _parse_metadata(response):
    '''
    
    '''

    if response is None or response.headers is None:
        return None

    metadata = _dict()
    for key, value in response.headers.items():
        if key.lower().startswith('x-ms-meta-'):
            metadata[key[10:]] = _to_str(value)

    return metadata
1080070
function jsonKeyExists(json, key) {
  var keys = key.split('.')
  var cur = json

  for (var i = 0; i < keys.length; i++) {
    try {
      cur = cur[keys[i]]
      if (cur === undefined) return false
    } catch(e) {
      return false
    }
  }

  return true
}
869351
public boolean readMetaDataIfNeeded() throws IOException {
    if (eofReached) {
      return false;
    }
    if (rawBlockOffset == 0) {
      try {
        metaDataConsumer.readMetaData(in, metaDataBlockSize);
        rawBlockOffset += metaDataBlockSize;
      } catch (EOFException e) {
        eofReached = true;
        return false;
      }
    }
    return true;
  }
273974
def _metadata_is_invalid(cls, fact):
        
        return any(isinstance(token, URIRef) and ' ' in token
                   for token in fact)