Return true if the ident matches the provider def metadata
331408
private boolean matchesProvider(final ProviderIdent ident, final ProviderDef pluginDef) {
        return ident.getService().equals(pluginDef.getService()) && ident.getProviderName().equals(pluginDef.getName());
    }
157138
public boolean matches(Archive source) {
        if (includePattern != null) {
            return source.reader().entries().stream()
                    .map(name -> name.replace('/', '.'))
                    .filter(name -> !name.equals("module-info.class"))
                    .anyMatch(this::matches);
        }
        return hasTargetFilter();
    }
165775
def is_identifier(string):
    
    matched = PYTHON_IDENTIFIER_RE.match(string)
    return bool(matched) and not keyword.iskeyword(string)
694598
protected boolean doesMetaDataMatch(final KeyValueNode<?> metaData, final CSNodeWrapper node) {
        if (!(node.getNodeType().equals(CommonConstants.CS_NODE_META_DATA) || node.getNodeType().equals(
                CommonConstants.CS_NODE_META_DATA_TOPIC))) return false;

        // If the unique id is not from the parser, in which case it will start with a number than use the unique id to compare
        if (metaData.getUniqueId() != null && metaData.getUniqueId().matches("^\\d.*")) {
            return metaData.getUniqueId().equals(Integer.toString(node.getId()));
        } else {
            // Allow for old abstract references.
            if (metaData.getKey().equals(CommonConstants.CS_ABSTRACT_TITLE) && node.getTitle().equals(
                    CommonConstants.CS_ABSTRACT_ALTERNATE_TITLE)) {
                return true;
            }

            // Allow for alternate file references.
            if (metaData.getKey().equals(CommonConstants.CS_FILE_TITLE) && node.getTitle().equals(CommonConstants.CS_FILE_SHORT_TITLE)) {
                return true;
            }

            // Check if the key matches, if it does than the nodes match.
            return metaData.getKey().equals(node.getTitle());
        }
    }
1022882
def provider_of(iface):
    
    def check(value):
        return (
            iface.providedBy(value),
            u"{value!r} does not provide {interface!s}".format(
                value=value,
                interface=fullyQualifiedName(iface),
            ),
        )
    return check
978255
def isidentifier(s, dotted=False):
    '''
    
    '''
    if dotted:
        return all(isidentifier(a) for a in s.split('.'))
    if PY3:
        return s.isidentifier()
    else:
        import re
        _name_re = re.compile(r"[a-zA-Z_][a-zA-Z0-9_]*$")
        return bool(_name_re.match(s))
545252
function isIdentifier(name, ecmaVersion) {
    if (ecmaVersion >= 6) {
        return esutils.keyword.isIdentifierES6(name);
    }
    return esutils.keyword.isIdentifierES5(name);
}
932403
def find_providers(self, reqt):
        
        matcher = self.get_matcher(reqt)
        name = matcher.key   # case-insensitive
        result = set()
        provided = self.provided
        if name in provided:
            for version, provider in provided[name]:
                try:
                    match = matcher.match(version)
                except UnsupportedVersionError:
                    match = False

                if match:
                    result.add(provider)
                    break
        return result
380420
async function getMetadata(auth, identifier) {
    // Try to get info assuming identifier is an id
    const metadata = await new Promise((resolve, reject) => {
        const script = google.script('v1');
        script.projects.get({
            auth,
            scriptId: identifier,
        }, (err, result) => {
            if (err) {
                resolve(false);
            } else {
                resolve(result.data);
            }
            return;
        });
    });

    if (metadata) {
        return {
            projectId: metadata.scriptId,
            name: metadata.title,
            createTime: metadata.createTime,
            updateTime: metadata.updateTime,
            creator: {
                name: metadata.creator.name,
                email: metadata.creator.email,
            },
        };
    }

    // Identifier did not match an id
    const files = await getScripts(auth, identifier, null, []);
    if (files.length === 0) { // 0 results
        throw {
            message: `No remote project with name or id '${identifier}' found ${checkbox.get('red')}\n` +
                `Use 'gas get projects' to show all your remote Google Apps Script projects`,
            print: true,
        };
    } else if (files.length === 1) { // 1 result
        const result = files[0];
        if (result.name === identifier) {
            result.name = sanitize(result.name);
            return {
                projectId: result.id,
                name: result.name,
                createTime: result.createdTime,
                updateTime: result.modifiedTime,
                creator: {
                    name: '',
                    email: '',
                },
            };
        } else {
            // Check for exact match if exists
            throw {
                message: `No exact match with name or id '${identifier}' found ${checkbox.get('red')}\n` +
                    `Did you perhaps mean: '${result.name}'?`,
                print: true,
            };
        }
    } else { // More than 1 result
        const exactMatches = [];
        for (const match of files) {
            if (match.name === identifier) {
                exactMatches.push(match);
            }
        }
        if (exactMatches.length === 0) { // 0 results
            let message = `No project called '${identifier}' found ${checkbox.get('red')}\n`;
            message += 'Did you mean one of these projects? :\n';
            for (const file2 of files) {
                message += `[${file2.id}] ${file2.name}\n`;
            }
            const err = {
                message,
                print: true,
            };
        } else if (exactMatches.length === 1) { // 1 result
            exactMatches[0].name = sanitize(exactMatches[0].name);
            return {
                projectId: exactMatches[0].id,
                name: exactMatches[0].name,
                createTime: exactMatches[0].createdTime,
                updateTime: exactMatches[0].lastModifiedAt,
                creator: {
                    name: '',
                    email: '',
                },
            };
        } else {
            let message = `Multiple projects called '${identifier}' found ${checkbox.get('red')}\n`;
            message += `Use 'gas rename <projectId> <newProjectName>' to rename script so they have a unique name or use the projectId as identifier\n\n`;
            for (const exactMatch of exactMatches) {
                message += `[${exactMatch.id}] ${exactMatch.name}\n`;
            }
            throw {
                message,
                print: true,
            };
        }
    }
}
1131729
def _check_package(pkg_xml, zipfilename, zf):
  
  # The filename must patch the id given in the XML file.
  uid = os.path.splitext(os.path.split(zipfilename)[1])[0]
  if pkg_xml.get('id') != uid:
    raise ValueError('package identifier mismatch (%s vs %s)' %
             (pkg_xml.get('id'), uid))

  # Zip file must expand to a subdir whose name matches uid.
  if sum( (name!=uid and not name.startswith(uid+'/'))
      for name in zf.namelist() ):
    raise ValueError('Zipfile %s.zip does not expand to a single '
             'subdirectory %s/' % (uid, uid))
415386
def Match(self, registry_key):
    
    key_path = registry_key.path.upper()
    # Prevent this filter matching non-string MRUList values.
    for ignore_key_path_suffix in self._IGNORE_KEY_PATH_SUFFIXES:
      if key_path.endswith(ignore_key_path_suffix):
        return False

    return super(MRUListStringRegistryKeyFilter, self).Match(registry_key)
1338382
def _is_dataset(uri, config_path):
    """"""
    uri = dtoolcore.utils.sanitise_uri(uri)
    storage_broker = _get_storage_broker(uri, config_path)
    return storage_broker.has_admin_metadata()
856524
def exists(self):
    
    try:
      return self.metadata is not None
    except datalab.utils.RequestException:
      return False
    except Exception as e:
      raise e
12292
def com_google_fonts_check_metadata_match_name_familyname(family_metadata, font_metadata):
  """"""
  if font_metadata.name != family_metadata.name:
    yield FAIL, ("METADATA.pb: {}: Family name \"{}\""
                 " does not match"
                 " font name: \"{}\"").format(font_metadata.filename,
                                              family_metadata.name,
                                              font_metadata.name)
  else:
    yield PASS, "Font name is the same as family name."
605416
function isPackageMeta(file) {
  if (file.match(/^readme(\.[^\.]*)$/i)) {
    return true;
  }
  if (file.match(/^(license|licence)(\.[^\.]*)?$/i)) {
    return true;
  }
  if (file.match(/^(notice)(\.[^\.]*)?$/i)) {
    return true;
  }
  if (file.match(/^(changes|changelog|history)(\.[^\.]*)?$/i)) {
    return true;
  }
}
185370
def IsMetaMetaDict(AST):
    
    isintpair = lambda x : (isinstance(x,Tuple) and (len(x.asList()) == 2) and 
                            isctype(x.asList()[0], int) and 
                            isctype(x.asList()[1], int))
    try:
        if ((len(AST.getChildren()) > 1) and 
            isinstance(AST.getChildren()[1], Stmt)):
            if isinstance(AST.getChildren()[1].getChildren()[0], Assign):
                [s, d] = AST.getChildren()[1].getChildren()[0].asList()
    except (TypeError, AttributeError):
        return False
    else:
        if (isinstance(s, AssName) and s.name == 'metametadata'):     
            if isinstance(d, Dict):
                return all([isctype(k, str) and 
                            (isctype(v, int) or isintpair(v)) 
                            for (k,v) in d.items])
880936
def check_metadata_link(self, ds):
        '''
        
        '''
        if not hasattr(ds, u'metadata_link'):
            return
        msgs = []
        meta_link = getattr(ds, 'metadata_link')
        if 'http' not in meta_link:
            msgs.append('Metadata URL should include http:// or https://')
        valid_link = (len(msgs) == 0)
        return Result(BaseCheck.LOW, valid_link, 'metadata_link_valid', msgs)