Otherwise (default) make sure this id is unused first
19395
function guidWithCheck(callback) {
        const id = guid();
        context.getObject(id, function (err, value) {
          if (err) {
            callback(err);
            return;
          }

          // If this id is unused, use it, otherwise find another
          if (!value) {
            callback(null, id);
          } else {
            guidWithCheck(callback);
          }
        });
      }
280450
def usable_id(cls, id):
        
        try:
            qry_id = int(id)
        except Exception:
            qry_id = None

        if not qry_id:
            msg = 'unknown identifier %s' % id
            cls.error(msg)

        return qry_id
615941
def unused(self):
        
        self._params.update(
            href=self._resource.get('search_unused'))
        return self
168728
def _handle_id(self, node, scope, ctxt, stream):
        
        if node.name == "__root":
            return self._root
        if node.name == "__this" or node.name == "this":
            return ctxt

        self._dlog("handling id {}".format(node.name))
        field = scope.get_id(node.name)

        is_lazy = getattr(node, "is_lazy", False)

        if field is None and not is_lazy:
            raise errors.UnresolvedID(node.coord, node.name)
        elif is_lazy:
            return LazyField(node.name, scope)

        return field
884081
function (id) {
    for (var key in this.active) {
      if (this.active.hasOwnProperty(key) && this.active[key].id === id) {
        return true;
      }
    }
    return false;
  }
1284785
def _set_id(self, Id, is_added, index):
        """"""
        if is_added:
            self.selected_ids.add(Id)
        else:
            self.selected_ids.remove(Id)
        self.dataChanged.emit(index, index)
714920
def problem_id(self, value):
        
        if value == self._defaults['problemId'] and 'problemId' in self._values:
            del self._values['problemId']
        else:
            self._values['problemId'] = value
1212464
private void refreshId()
	{
		if (null == getName())
		{
			setId(null);
		}
		else
		{
			if (null == getIdSuffix())
			{
				setId(getName());
			}
			else
			{
				setId(getName() + getIdSuffix());
			}
		}
	}
1370734
function checkId(id) {
  id = id || "";
  id = id.toString();
  return _.isString(id) && id.length === 24;
}
740979
def delete(ids, force):
    """"""
    records_deprecation_warning()

    from .api import Record
    for id_ in ids:
        record = Record.get_record(id_, with_deleted=force)
        record.delete(force=force)
    db.session.commit()
683535
def set_id(self, dxid):
        '''
        
        '''
        if dxid is not None:
            verify_string_dxid(dxid, self._class)

        self._dxid = dxid
733534
protected function shouldRegenerateId()
    {
        if (($this->idRequestsLimit) && ($this->requestsCount >= $this->idRequestsLimit)) {
            return true;
        }

        if (($this->idTtl && $this->regenerationTrace) && ($this->regenerationTrace + $this->idTtl < time())) {
            return true;
        }

        return false;
    }
573622
function getDocWithDefault(db, id, defaultDoc) {
  return db.get(id).catch(function (err) {
    /* istanbul ignore if */
    if (err.status !== 404) {
      throw err;
    }
    defaultDoc._id = id;
    return db.put(defaultDoc).catch(function (err) {
      /* istanbul ignore if */
      if (err.status !== 409) { // conflict
        throw err;
      }
    }).then(function () {
      return db.get(id);
    });
  });
}
1172034
function checkForDuplicateIds( page ) {
      const idCount = {};
      forEachArea( page, items => {
         items.forEach( ({ id }) => {
            idCount[ id ] = idCount[ id ] ? idCount[ id ] + 1 : 1;
         } );
      } );

      const duplicates = Object.keys( idCount ).filter( id => idCount[ id ] > 1 );
      if( duplicates.length ) {
         throw formatError( page, `Duplicate widget/composition/layout ID(s): ${duplicates.join( ', ' )}` );
      }
   }
693556
function modCompletePreDefine(currentId) {
        // HACK: 这里在IE下有个性能陷阱，不能使用任何变量。
        //       否则貌似会形成变量引用和修改的读写锁，导致wait4PreDefine释放困难
        each(wait4PreDefine, function (mod) {
            modPreDefine(
                currentId,
                mod.deps,
                mod.factory
            );
        });

        wait4PreDefine.length = 0;
    }
954646
def deprecate(old, new, reference: '', ids: [])
      return if @ignored.include?('deprecations') || (@ignored & ids.map!(&:to_s)).any?

      msg = ids.empty? ? '' : "[#{ids.map(&:inspect).join(', ')}] "
      ref_msg = reference.empty? ? '.' : "; see explanation for this deprecation: #{reference}."
      warn "[DEPRECATION] #{msg}#{old} is deprecated. Use #{new} instead#{ref_msg}"
    end
161869
def use(self, id):
        
        if self._connected and id > 0:
            self.send_command('use', keys={'sid': id})