Get an ID from a user, creates if necessary
9871
def get_id_from_user(user):
    """"""
    id = r_client.hget('user-id-map', user)
    if id is None:
        id = str(uuid4())
        r_client.hset('user-id-map', user, id)
        r_client.hset('user-id-map', id, user)
    return id
1136240
def _initialize_id(self):
        """"""
        self.id = str(self.db.incr(self._key['id']))
209438
function (onDone) {
		
	l_validateUID();	
	var uid = ++l_states['uid_count'];	
	
	// store back to DB
    // check existing users
	SR.DB.setData(SR.Settings.DB_NAME_SYSTEM, l_states, 
				  	// success
				  	function (data) {
						LOG.warn('uid generated: ' + uid);
						onDone(uid);
				  	},
				  	// fail
				  	function () {
						LOG.error('uid generation failed with DB');
						onDone(undefined);
				  	});	
}
164862
def ensure_user(data)
      if @users.include?(data['id'].to_i)
        @users[data['id'].to_i]
      else
        @users[data['id'].to_i] = User.new(data, self)
      end
    end
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
477833
def get_user_by_id(uid,**kwargs):
    
    user_id = kwargs.get('user_id')
    try:
        user_i = _get_user(uid)
        return user_i
    except NoResultFound:
        return None
1045015
def get_user_by_id(self, uid):
        """"""
        self.logger.debug('User %s has been found in database', uid)
        return dict(uid=uid, password_hash='secret_hash')
544520
def int_id(self):
        ""
        id_or_name = self.id_or_name
        if id_or_name is not None and isinstance(id_or_name, int):
            return id_or_name
        return None
531029
def user(id)
      if id
        cached_user = users.detect {|u| u[:id] == id }
        user = cached_user || fetch_user(id)
        self.users << user
        user
      end
    end
545728
def id(self, id):
        
        if id is None:
            raise ValueError("Invalid value for `id`, must not be `None`")
        if id is not None and len(id) > 250:
            raise ValueError("Invalid value for `id`, length must be less than or equal to `250`")
        if id is not None and len(id) < 1:
            raise ValueError("Invalid value for `id`, length must be greater than or equal to `1`")

        self._id = id
140079
def get_user(self, idvalue, options=None):
        
        options = options or {}
        data = options.copy()
        data['id'] = idvalue
        return self.api_get('user', data)
7864
def save_user(self, idvalue, options=None):
        
        options = options or {}
        data = options.copy()
        data['id'] = idvalue
        return self.api_post('user', data)
904576
def created_by(self):
        
        if self.api and self.created_by_id:
            return self.api._get_user(self.created_by_id)
1370734
function checkId(id) {
  id = id || "";
  id = id.toString();
  return _.isString(id) && id.length === 24;
}
313800
function getRequestId(req) {
  const id = uuid.v1();
  req.id = id;
  return {
    req_id: id,
  };
}
1375058
def get_id(self):
        
        if self._id is None:
            self._id = graceful_get(self.inspect(refresh=True), "ID")
        return self._id
1300430
def get(self, id):
        """"""
        params = {'q': 'id:%s' % str(id), 'wt': 'python'}
        request = urllib.parse.urlencode(params, doseq=True)
        data = None
        try:
            rsp = self.doPost(self.solrBase + '', request, self.formheaders)
            data = eval(rsp.read())
        except Exception:
            pass
        if data['response']['numFound'] > 0:
            return data['response']['docs'][0]
        return None