Determine contextual idents (cidents)
514098
def _contextualise(self):
        ''''''
        # loop through hierarchy identifying unique lineages
        # TODO: gain other contextual information, not just ident
        deja_vues = []
        for rank in reversed(self.taxonomy):
            # return named clades -- '' are ignored
            clades = [e for e in self.hierarchy[rank] if e[1]]
            # print 'Rank: {0} - {1}'.format(rank, len(clades))
            # get unique lineages at this level
            uniques = [e for e in clades if len(e[0]) == 1]
            # removed those already seen
            uniques = [e for e in uniques if e[0][0].ident not in deja_vues]
            # add each to self[ident]['cident']
            for e in uniques:
                ident = e[0][0].ident
                self[ident]['cident'] = e[1]
                deja_vues.append(ident)
1013640
def get_current_context_id():
    
    global get_current_context_id
    if greenlet is not None:
        if stackless is None:
            get_current_context_id = greenlet.getcurrent
            return greenlet.getcurrent()
        return greenlet.getcurrent(), stackless.getcurrent()
    elif stackless is not None:
        get_current_context_id = stackless.getcurrent
        return stackless.getcurrent()
    get_current_context_id = _thread.get_ident
    return _thread.get_ident()
1372452
def listidentifiers(**kwargs):
    """"""
    e_tree, e_listidentifiers = verb(**kwargs)
    result = get_records(**kwargs)

    for record in result.items:
        pid = oaiid_fetcher(record['id'], record['json']['_source'])
        header(
            e_listidentifiers,
            identifier=pid.pid_value,
            datestamp=record['updated'],
            sets=record['json']['_source'].get('_oai', {}).get('sets', []),
        )

    resumption_token(e_listidentifiers, result, **kwargs)
    return e_tree
766444
def t_ANY_ID(self, token):
        '
        if token.value in self.KEYWORDS:
            if (token.value == 'annotation_type') and self.cur_indent:
                # annotation_type was added as a reserved keyword relatively
                # late, when there could be identifers with the same name
                # in existing specs. because annotation_type-the-keyword can
                # only be used at the beginning of a non-indented line, this
                # check lets both the keyword and the identifer coexist and
                # maintains backward compatibility.
                # Note: this is kind of a hack, and we should get rid of it if
                # the lexer gets better at telling keywords from identifiers in general.
                return token
            token.type = self.RESERVED.get(token.value, 'KEYWORD')
            return token
        else:
            return token
1292968
def find_identifier(self):
        """"""
        features = self.data['features']
        n = len(features)
        feature = features[0]
        if 'id' in feature and len(set(feat['id'] for feat in features)) == n:
            return 'feature.id'
        for key in feature.get('properties', []):
            if len(set(feat['properties'][key] for feat in features)) == n:
                return 'feature.properties.{}'.format(key)
        if self.embed:
            for i, feature in enumerate(self.data['features']):
                feature['id'] = str(i)
            return 'feature.id'
        raise ValueError(
            'There is no unique identifier for each feature and because '
            '`embed=False` it cannot be added. Consider adding an `id` '
            'field to your geojson data or set `embed=True`. '
        )
950449
def getDignities(self):
        
        info = self.getInfo()
        dignities = [dign for (dign, objID) in info.items()
                        if objID == self.obj.id]
        return dignities
201346
function parseAttributePath(attrPath, context) {
    const parsed = attrPath.split('.');
    parsed.forEach(item => checkIdentifier(item, context));
    return parsed;
}
496052
def p_identifier(self, tree):
        '''  '''
        tree.value = tree.attr
        tree.svalue = tree.attr
935564
def get_context(namespace, context_id):
    """"""
    context_obj = get_state(context_id, namespace=namespace)
    if not context_obj:
        raise ContextError("Context '{}' not found in namespace '{}'".format(
            context_id, namespace))
    return context_obj
1073374
def unique_identifier(self):
        
        for t in IDENTIFIER_PRIORITY:
            found = self._tree.getroot().find('.//mods:identifier[@type="%s"]' % t, NS)
            if found is not None:
                return found.text
832231
private String identifier(boolean firstCanBeNumber) {
	if (!cfml.isCurrentLetter() && !cfml.isCurrentSpecial()) {
	    if (!firstCanBeNumber) return null;
	    else if (!cfml.isCurrentDigit()) return null;
	}
	boolean doUpper;
	PageSource ps = pc == null ? null : pc.getCurrentPageSource();
	if (ps != null) doUpper = !isJson && ps.getDialect() == CFMLEngine.DIALECT_CFML && ((MappingImpl) ps.getMapping()).getDotNotationUpperCase();
	else doUpper = !isJson && ((ConfigWebImpl) config).getDotNotationUpperCase(); // MUST .lucee should not be upper case

	StringBuilder sb = new StringBuilder();
	sb.append(doUpper ? cfml.getCurrentUpper() : cfml.getCurrent());
	do {
	    cfml.next();
	    if (!(cfml.isCurrentLetter() || cfml.isCurrentDigit() || cfml.isCurrentSpecial())) {
		break;
	    }

	    sb.append(doUpper ? cfml.getCurrentUpper() : cfml.getCurrent());
	}
	while (cfml.isValidIndex());
	return sb.toString();// cfml.substringLower(start,cfml.getPos()-start);
    }
1064976
def identifier(self):
        """"""
        ident = self._json['coredata']['dc:identifier'].split(":")[-1]
        if ident != self._id:
            text = "Profile with ID {} has been merged and the new ID is "\
                   "{}.  Please update your records manually.  Files have "\
                   "been cached with the old ID.".format(self._id, ident)
            warn(text, UserWarning)
        return ident
652914
function determineContext( scope ) {
   let current = scope;
   while( !current.hasOwnProperty( 'widget' ) && current !== current.$root ) {
      current = current.$parent;
   }

   const isInWidget = !!current.widget;

   return {
      widgetName: isInWidget ? current.widget.path : '',
      widgetId: isInWidget ? current.widget.id : '',
      widgetScopeId: isInWidget ? current.$id : null,
      scopeId: scope.$id
   };
}
667019
def p_scope_identifier(self, p):
        ''
        p[0] = Identifier(p[2], p[1], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
716052
def normalize_ident(ident):
    '''
    '''
    if isinstance(ident, tuple) and len(ident) == 2:
        return ident[0], ident[1]  # content_id, subtopic_id
    else:
        return ident, None
7911
def check_declared(self, node):
        """"""

        for ident in node.undeclared_identifiers():
            if ident != 'context' and\
                    ident not in self.declared.union(self.locally_declared):
                self.undeclared.add(ident)
        for ident in node.declared_identifiers():
            self.locally_declared.add(ident)
284987
def imprints(self, key, value):
    """"""
    return {
        'place': value.get('a'),
        'publisher': value.get('b'),
        'date': normalize_date_aggressively(value.get('c')),
    }