Set an user's year. This is required on magma just before the login.
        It's called by default by ``login``.
977815
def set_year(self, year):
        
        self.year = YEARS.get(year, year)
        data = {'idCursus': self.year}
        soup = self.post_soup('/~etudiant/login.php', data=data)
        return bool(soup.select('ul.rMenu-hor'))
898293
public static void setUser(Object user)
    {
        HttpSession session = WebContextFactory.get().getSession(true);
        session.setAttribute(USER, user);
    }
526220
public void setDate(int year, int month, int day) {
        Calendar to = Calendar.getInstance();
        to.set(year, month, day);
        setDate(to);
    }
71227
def set_year(self, year):
        
        self._set_attr(TDRC(encoding=3, text=str(year)))
1005719
def set_napp(self, user, napp, version=None):
        
        self.user = user
        self.napp = napp
        self.version = version or 'latest'
606798
function (error) {

		if (error) {
			var err = new Error("set custom data for account [" + account + "] fail");
			err.name = "setUser Error";
			LOG.error('set custom data for account [' + account + '] fail', 'user');
			UTIL.safeCall(onDone, err);
		}
		else {
			LOG.warn('set custom data for account [' + account + '] success', 'user');
			UTIL.safeCall(onDone, null);
		}	
	}
446036
def set_session_token(self, session_token):
        
        self.session_token = session_token
        self._login_time = datetime.datetime.now()
936598
public final void setCurrentAccYear(
    final Date pCurrentAccYear) {
    if (pCurrentAccYear == null) {
      this.currentAccYear = null;
    } else {
      this.currentAccYear = new Date(pCurrentAccYear.getTime());
    }
  }
1329003
def _maybe_init_user(self):
    """"""
    user_name = os.environ.get('USER', '') or os.environ.get('USERNAME', '')
    cursor = self._db.cursor()
    cursor.execute('SELECT user_id FROM Users WHERE user_name = ?',
                   (user_name,))
    row = cursor.fetchone()
    if row:
      return row[0]
    user_id = self._create_id()
    cursor.execute(
        """
        INSERT INTO USERS (user_id, user_name, inserted_time)
        VALUES (?, ?, ?)
        """,
        (user_id, user_name, time.time()))
    return user_id
776814
function () {
            if (!this.isSet(YEAR)) {
                throw new Error('year must be set for KISSY GregorianCalendar');
            }
            var fields = this.fields;
            var year = fields[YEAR];
            var timeOfDay = 0;
            if (this.isSet(HOUR_OF_DAY)) {
                timeOfDay += fields[HOUR_OF_DAY];
            }
            timeOfDay *= 60;
            timeOfDay += fields[MINUTE] || 0;
            timeOfDay *= 60;
            timeOfDay += fields[SECONDS] || 0;
            timeOfDay *= 1000;
            timeOfDay += fields[MILLISECONDS] || 0;
            var fixedDate = 0;
            fields[YEAR] = year;
            fixedDate = fixedDate + this.getFixedDate();    // millis represents local wall-clock time in milliseconds.
            // millis represents local wall-clock time in milliseconds.
            var millis = (fixedDate - EPOCH_OFFSET) * ONE_DAY + timeOfDay;
            millis -= this.timezoneOffset * ONE_MINUTE;
            this.time = millis;
            this.computeFields();
        }
334493
def set_user_session(user):
    
    from uliweb import settings, request

    user_fieldname = settings.get_var('AUTH/GET_AUTH_USER_FIELDNAME', 'id')
    share_session = settings.get_var('AUTH/AUTH_SHARE_USER_SESSION', False)
    if isinstance(user, dict):
        user_id = user[user_fieldname]
    else:
        user_id = getattr(user, user_fieldname)

    if share_session:
        cache = functions.get_cache()
        key = get_user_session_key(user_id)
        session_id = cache.get(key, None)
        log.debug('Auth: user session user_id={}, session_id={}, key={}'.format(user_id, session_id, key))
        if not session_id:
            request.session.save()
            log.debug('Auth: set user session mapping userid={}, '
                      'session_id={}, expiry time={}'.format(user_id,
                                                             request.session.key,
                                                             request.session.expiry_time))
            cache.set(key, request.session.key, expire=request.session.expiry_time)
        elif session_id != request.session.key:
            log.debug('Auth: load oldkey={}, key={}'.format(request.session.key, session_id))
            request.session.delete()
            request.session.load(session_id)
    if isinstance(user, dict):
        request.session[_get_auth_key()] = user
    else:
        request.session[_get_auth_key()] = user_id
    request.user = user
1335957
public void setUser(String user) {
		if(isModifiable == ModifiableRule.NotModifiable) {
			throw new IllegalArgumentException("not allowed to set user part, the URI is not modifiable");
		}
		try {
			getSipURI().setUser(user);			
		} catch (ParseException e) {
			logger.error("error setting parameter ", e);
		}
	}
129029
def login(self, year, firstname, lastname, passwd, with_year=True):
        
        firstname = firstname.upper()
        lastname = lastname.upper()

        if with_year and not self.set_year(year):
            return False

        url = URLS['login']
        params = {
            'prenom': firstname,
            'nom': lastname,
            'pwd': passwd,
        }

        soup = self.post_soup(url, data=params)

        return not soup.select('font[color=red]')
757080
def set_cookie(self, name: str, value: str, *,
                   expires: Optional[str]=None,
                   domain: Optional[str]=None,
                   max_age: Optional[Union[int, str]]=None,
                   path: str='/',
                   secure: Optional[str]=None,
                   httponly: Optional[str]=None,
                   version: Optional[str]=None) -> None:
        

        old = self._cookies.get(name)
        if old is not None and old.coded_value == '':
            # deleted cookie
            self._cookies.pop(name, None)

        self._cookies[name] = value
        c = self._cookies[name]

        if expires is not None:
            c['expires'] = expires
        elif c.get('expires') == 'Thu, 01 Jan 1970 00:00:00 GMT':
            del c['expires']

        if domain is not None:
            c['domain'] = domain

        if max_age is not None:
            c['max-age'] = str(max_age)
        elif 'max-age' in c:
            del c['max-age']

        c['path'] = path

        if secure is not None:
            c['secure'] = secure
        if httponly is not None:
            c['httponly'] = httponly
        if version is not None:
            c['version'] = version
1098302
public void setDate(int day, int month, int year){
        if(mAdapter.getYear() == year && mAdapter.getMonth() == month && mAdapter.getDay() == day)
            return;

        mAdapter.setDate(day, month, year, false);
        goTo(month, year);
    }
144529
def set_cookie(  # type: ignore
            self,
            key: str,
            value: AnyStr='',
            max_age: Optional[Union[int, timedelta]]=None,
            expires: Optional[datetime]=None,
            path: str='/',
            domain: Optional[str]=None,
            secure: bool=False,
            httponly: bool=False,
    ) -> None:
        
        if isinstance(value, bytes):
            value = value.decode()  # type: ignore
        cookie = create_cookie(key, value, max_age, expires, path, domain, secure, httponly)  # type: ignore  # noqa: E501
        self.headers.add('Set-Cookie', cookie.output(header=''))
359176
def initialize(self, id, timestamp=None, user=None, page=None, minor=None,
                   comment=None, text=None, bytes=None, sha1=None,
                   parent_id=None, model=None, format=None, deleted=None):

        self.id = none_or(id, int)
        

        self.timestamp = none_or(timestamp, Timestamp)
        """
        Revision timestamp : :class:`mwtypes.Timestamp`
        """

        self.user = none_or(user, User)
        """
        Contributing user metadata : :class:`~mwtypes.User`
        """

        self.page = none_or(page, Page)
        """
        Page metadata : :class:`~mwtypes.Page`
        """

        self.minor = none_or(minor, bool)
        """
        Is revision a minor change? : `bool`
        """

        self.comment = none_or(comment, str)
        """
        Comment left with revision : `str`
        """

        self.text = none_or(text, str)
        """
        Content of text : `str`
        """

        self.bytes = none_or(bytes, int)
        """
        Number of bytes of content : `int`
        """

        self.sha1 = none_or(sha1, str)
        """
        sha1 hash of the content : `str`
        """

        self.parent_id = none_or(parent_id, int)
        """
        Revision ID of preceding revision : `int` | `None`
        """

        self.model = none_or(model, str)
        """
        TODO: ??? : `str`
        """

        self.format = none_or(format, str)
        """
        TODO: ??? : `str`
        """

        self.deleted = none_or(deleted, self.Deleted)
        """
        The deleted/suppressed status of the revision.
        """