:param id_prefix: Prefix of the #id thing. Set a string, or true to have it generated.
        :type  id_prefix: str|bool
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
527376
def update(self, prefixes):
        
        if self.ip_prefix not in prefixes:
            prefixes.append(self.ip_prefix)
            self.log.info("announcing %s for %s", self.ip_prefix, self.name)
            return True

        return False
13351
def string_id(self):
    
    id = self.id()
    if not isinstance(id, basestring):
      id = None
    return id
545300
def remove_prefix(self, id):
        

        if 'prefix' not in request.params:
            abort(400, 'Missing prefix.')
        prefix = Prefix.get(int(request.params['prefix']))
        prefix.pool = None
        prefix.save()

        redirect(url(controller = 'pool', action = 'edit', id = id))
1246486
def set_prefix(self, prefix=None):
        
        if prefix is None:
            self._pfx = None
        else:
            self._pfx = prefix + self.SEP
278167
function (prefix, obj) {
            if (!obj.attr('id')) {
                var generated_id;
                do {
                    generated_id = prefix + '_' + randomNumber();
                } while ($('#' + generated_id).length > 0);
                obj.attr('id', generated_id);
            }
            return obj.attr('id');
        }
358812
def find_by_prefix(prefix)
      @machines.each do |uuid, data|
        return data.merge("id" => uuid) if uuid.start_with?(prefix)
      end

      nil
    end
107332
def get_default_prefix(self, instance=None):
        
        if instance is None and hasattr(self, 'instance'):
            instance = self.instance

        if instance and instance.id is not None:
            # it's an existing instance, use the instance prefix
            instance_prefix = self.default_instance_prefix
            if instance_prefix is None:
                instance_prefix = self.__class__.__name__.lower() + 'i-'

            return '{0}{1}'.format(instance_prefix,
                                   instance.id)

        if self.default_new_prefix is not None:
            return self.default_new_prefix

        return self.__class__.__name__.lower() + 'new-'
440592
def set_id(self,i):
        
        if self.type == 'NAF':
            self.node.set('id',i)
        elif self.type == 'KAF':
            self.node.set('mid',i)
1100727
def extract_prefix_attr(cls, req):
        

        # TODO: add more?
        attr = {}
        if 'id' in req:
            attr['id'] = int(req['id'])
        if 'prefix' in req:
            attr['prefix'] = req['prefix']
        if 'pool' in req:
            attr['pool_id'] = int(req['pool'])
        if 'node' in req:
            attr['node'] = req['node']
        if 'type' in req:
            attr['type'] = req['type']
        if 'country' in req:
            attr['country'] = req['country']
        if 'indent' in req:
            attr['indent'] = req['indent']

        return attr
109736
def register_id(self, id_string):
        
        try:
            prefix, count = id_string.rsplit("_", 1)
            count = int(count)
        except ValueError:
            # We don't need to worry about ids that don't match our pattern
            pass
        else:
            if prefix == self.prefix:
                self.counter = max(count, self.counter)
860217
def id(self, id):
        

        if id is None:
            raise ValueError("Invalid value for `id`, must not be `None`")
        if len(id) > 255:
            raise ValueError("Invalid value for `id`, length must be less than `255`")

        self._id = id
1004321
private static int setID(String prefix, int identifier, IChemObject object, List<String> tabuList) {
        identifier += 1;
        while (tabuList.contains(prefix + identifier)) {
            identifier += 1;
        }
        object.setID(prefix + identifier);
        tabuList.add(prefix + identifier);
        return identifier;
    }
413413
def module_set_id(self) -> str:
        
        fnames = sorted(["@".join(m) for m in self.schema_data.modules])
        return hashlib.sha1("".join(fnames).encode("ascii")).hexdigest()
193752
def id_generator(start=0):
    
    count = start
    while True:
        send_value = (yield count)
        if not send_value is None:
            if send_value < count:
                raise ValueError('Values from ID generator must increase '
                                 'monotonically (current value: %d; value '
                                 'sent to generator: %d).'
                                 % (count, send_value))
            count = send_value
        else:
            count += 1
547201
def t_ID(self, t):
        '
        res = self.oper.get(t.value, None)  # Check for reserved words
        if res is None:
            res = t.value.upper()
            if res == 'FALSE':
                t.type = 'BOOL'
                t.value = False
            elif res == 'TRUE':
                t.type = 'BOOL'
                t.value = True
            else:
                t.type = 'ID'
        else:
            t.value = res
            t.type = 'FUNCTION'
        return t
850237
public function setIdPrefix(string $prefix = null)
    {
        foreach ((array)$this as $element) {
            if (is_object($element)) {
                $element->setIdPrefix($prefix);
            }
        }
    }