Given a marked ID, returns the original ID and its :tl:`Peer` type.
761007
def resolve_id(marked_id):
    """"""
    if marked_id >= 0:
        return marked_id, types.PeerUser

    # There have been report of chat IDs being 10000xyz, which means their
    # marked version is -10000xyz, which in turn looks like a channel but
    # it becomes 00xyz (= xyz). Hence, we must assert that there are only
    # two zeroes.
    m = re.match(r'-100([^0]\d*)', str(marked_id))
    if m:
        return int(m.group(1)), types.PeerChannel

    return -marked_id, types.PeerChat
286729
def _pid_to_id(self, pid):
        """"""
        return d1_common.url.joinPathElements(
            self._base_url,
            self._version_tag,
            "resolve",
            d1_common.url.encodePathElement(pid),
        )
100817
def get(cls, id):
        

        # cached?
        if CACHE:
            if id in _cache['Pool']:
                log.debug('cache hit for pool %d' % id)
                return _cache['Pool'][id]
            log.debug('cache miss for pool %d' % id)

        try:
            pool = Pool.list({'id': id})[0]
        except (IndexError, KeyError):
            raise NipapNonExistentError('no pool with ID ' + str(id) + ' found')

        _cache['Pool'][id] = pool
        return pool
780576
def copy_id(self):
        '''
        
        '''
        stdout, stderr, retcode = self._run_cmd(self._copy_id_str_old())
        if salt.defaults.exitcodes.EX_OK != retcode and 'Usage' in stderr:
            stdout, stderr, retcode = self._run_cmd(self._copy_id_str_new())
        return stdout, stderr, retcode
163994
def get_commit_request(self, id): # pylint: disable=invalid-name,redefined-builtin
        
        schema = RequestSchema()
        resp = self.service.get(self.base+str(id)+'/request/')
        return self.service.decode(schema, resp)
1347064
def get_id(request):
        
        if isinstance(request, etree._Element):
            elem = request
        else:
            if isinstance(request, Document):
                request = request.toxml()
            elem = fromstring(request, forbid_dtd=True)
        return elem.get('ID', None)
20521
function getId(id){
        if(_.isObject(id) && !_.isUndefined(id.id)){
            if (objectIdRegex.test(id.id)) {
                id = id.id;
            }
            else {
                id = null;
            }
        }
        return id;
    }
1131467
def get_id(self):
        """"""
        if self._id_attr is None or not hasattr(self, self._id_attr):
            return None
        return getattr(self, self._id_attr)
1141856
def get_by_uid(post_id):
        '''
        
        '''
        return TabPost2Tag.select(
            TabPost2Tag,
            TabTag.name.alias('tag_name'),
            TabTag.uid.alias('tag_uid')
        ).join(
            TabTag, on=(TabPost2Tag.tag_id == TabTag.uid)
        ).where(
            (TabPost2Tag.post_id == post_id) & (TabTag.kind == 'z')
        )
1337386
def peer_retrieve(key, relation_name='cluster'):
    """"""
    cluster_rels = relation_ids(relation_name)
    if len(cluster_rels) > 0:
        cluster_rid = cluster_rels[0]
        return relation_get(attribute=key, rid=cluster_rid,
                            unit=local_unit())
    else:
        raise ValueError('Unable to detect'
                         'peer relation {}'.format(relation_name))
1304610
async def _into_id_set(client, chats):
    """"""
    if chats is None:
        return None

    if not utils.is_list_like(chats):
        chats = (chats,)

    result = set()
    for chat in chats:
        if isinstance(chat, int):
            if chat < 0:
                result.add(chat)  # Explicitly marked IDs are negative
            else:
                result.update({  # Support all valid types of peers
                    utils.get_peer_id(types.PeerUser(chat)),
                    utils.get_peer_id(types.PeerChat(chat)),
                    utils.get_peer_id(types.PeerChannel(chat)),
                })
        elif isinstance(chat, TLObject) and chat.SUBCLASS_OF_ID == 0x2d45687:
            # 0x2d45687 == crc32(b'Peer')
            result.add(utils.get_peer_id(chat))
        else:
            chat = await client.get_input_entity(chat)
            if isinstance(chat, types.InputPeerSelf):
                chat = await client.get_me(input_peer=True)
            result.add(utils.get_peer_id(chat))

    return result
1147820
def get_mark(self, mark_id):
        
        if mark_id in self.idx:
            return Cmarkable(self.idx[mark_id], self.type)
        else:
            return None
1209928
def _get_id(self):
        """"""
        return ''.join(map(str,
                           filter(is_not_None,
                                  [self.Prefix, self.Name])))
858631
def get_id(id_or_obj):
    
    if isinstance(id_or_obj, six.string_types + (int,)):
        # It's an ID
        return id_or_obj
    try:
        return id_or_obj.id
    except AttributeError:
        return id_or_obj
962774
def print_peer(self, peer, show_id=True, id_prefix="", reply=True):
        
        if isinstance(id_prefix, bool):
            if id_prefix:  # True
                if isinstance(peer, User):
                    id_prefix = "user"
                elif isinstance(peer, Chat):
                    id_prefix = peer.type
                else:
                    id_prefix = "unknown"
                # end if
            else:  # False
                id_prefix = ""
            # end if
        # end if
        peer_string = self.peer_to_string(peer)
        if show_id and "id" in peer:
            peer_string += " ({color_lightblue}{id_prefix}#{id}{color_off})".format(id_prefix=id_prefix, id=peer.id, **self.color.formatter)
        return peer_string
210595
def via_dom_id(self, dom_id, det_id):
        """"""
        try:
            return DOM.from_json([
                d for d in self._json
                if d["DOMId"] == dom_id and d["DetOID"] == det_id
            ][0])
        except IndexError:
            log.critical("No DOM found for DOM ID '{0}'".format(dom_id))
42512
function isAlreadyReplicating(state, feed_id, ignore_id) {
  for(var id in state.peers) {
    if(id !== ignore_id) {
      var peer = state.peers[id]
      if(peer.notes && getReceive(peer.notes[id])) return id
      if(peer.replicating && peer.replicating[feed_id] && peer.replicating[feed_id].rx) return id
    }
  }
  return false
}