Get an anchor by ID, or a prefix of its id.
436889
def _get_anchor(repo, id_prefix):
    
    result = None
    for anchor_id, anchor in repo.items():
        if anchor_id.startswith(id_prefix):
            if result is not None:
                raise ExitError(
                    ExitCode.DATA_ERR,
                    'Ambiguous ID specification')

            result = (anchor_id, anchor)

    if result is None:
        raise ExitError(
            ExitCode.DATA_ERR,
            'No anchor matching ID specification')

    return result
787173
def _get_id(self):
        """"""
        ret = None
        row = self.row
        if row:
            ret = row["id"]
        return ret
59782
def get_id2upper(objs):
    """"""
    id2upper = {}
    for obj in objs:
        _get_id2upper(id2upper, obj.item_id, obj)
    return id2upper
236844
def retrieve_by_id(self, id_):
        """"""
        items_with_id = [item for item in self if item.id == int(id_)]
        if len(items_with_id) == 1:
            return items_with_id[0].retrieve()
840959
private function getPrefixAndSid($id)
    {
        if (count($parts = explode('.', $id)) < 2) {
            return array(null, $id);
        }

        $sid    = array_pop($parts);
        $prefix = implode('.', $parts);

        return array($prefix, $sid);
    }
370833
function findNodeById(registry, id)
		{
			var rv = null;
			registry.forEach((e,i,a)=>{
				if(e.id === id)
					rv = e;
			});
			
			return rv;
		}
1352901
def by_id(self, id):
        """"""
        path = partial(_path, self.adapter)
        path = path(id)
        return self._get(path)
1260185
def string_position(self, id_):
        """"""
        if self.bow:
            return self.string_start[self.positions[id_]]
        else:
            return self.string_start[[self.positions[id_]]]
821593
def get_id2lower(objs):
    """"""
    id2lower = {}
    for obj in objs:
        _get_id2lower(id2lower, obj.item_id, obj)
    return id2lower
991353
def get(self, idx, default=None):
        
        for placeholder in self:
            if placeholder.element.ph_idx == idx:
                return placeholder
        return default
148064
def find_by_id(self, attachment, params={}, **options): 
        
        path = "/attachments/%s" % (attachment)
        return self.client.get(path, params, **options)
662633
def intToID(idnum, prefix):
    
    rid = ''

    while idnum > 0:
        idnum -= 1
        rid = chr((idnum % 26) + ord('a')) + rid
        idnum = int(idnum / 26)

    return prefix + rid
1114449
def get_suffix(id, regex="-[A-Z]{1}[0-9]{1,2}$"):
    
    parts = re.findall(regex, id)
    if not parts:
        return ""
    return parts[0]
387626
public E getById(String id) {
        if (id == null) {
            for (E element : this) {
                if (element != null && element.getId() == null) {
                    return element;
                }
            }
        } else {
            for (E element : this) {
                if (element != null && id.equals(element.getId())) {
                    return element;
                }
            }
        }
        return null;
    }
445446
public Permalink get(String id) {
        for (Permalink p : this)
            if(p.getId().equals(id))
                return p;
        return null;
    }
935313
def id(opts):
    '''
    
    '''
    r = salt.utils.http.query(opts['proxy']['url']+'id', decode_type='json', decode=True)
    return r['dict']['id'].encode('ascii', 'ignore')
612245
def map_id(self,id, prefix, closure_list):
        
        prefixc = prefix + ':'
        ids = [eid for eid in closure_list if eid.startswith(prefixc)]
        # TODO: add option to fail if no mapping, or if >1 mapping
        if len(ids) == 0:
            # default to input
            return id
        return ids[0]