Lists all the sessions of the users who have ever connected
           using this client and never logged out
551860
def list_sessions(cls):
        
        return [os.path.splitext(os.path.basename(f))[0]
                for f in os.listdir('.') if f.endswith(EXTENSION)]
898525
def list_users(runas=None):
    '''
    
    '''
    # Windows runas currently requires a password.
    # Due to this, don't use a default value for
    # runas in Windows.
    if runas is None and not salt.utils.platform.is_windows():
        runas = salt.utils.user.get_user()
    res = __salt__['cmd.run_all'](
        [RABBITMQCTL, 'list_users', '-q'],
        reset_system_locale=False,
        runas=runas,
        python_shell=False)

    # func to get tags from string such as "[admin, monitoring]"
    func = lambda string: [x.strip() for x in string[1:-1].split(',')] if ',' in string else [x for x in
                                                                                              string[1:-1].split(' ')]
    return _output_to_dict(res, func)
1220681
def users_list(self, *args):
        """"""
        if len(self._users) == 0:
            self.log('No users connected')
        else:
            self.log(self._users, pretty=True)
838417
def connections(self):
        """"""
        self._check_session()
        status, data = self._rest.get_request('connections')
        return data
1178535
async def get_users(self):
        """"""
        cmd = 'get_users'
        url = self.base_url + cmd
        users = []
        try:
            async with async_timeout.timeout(8, loop=self._loop):
                response = await self._session.get(url)

            logger("Status from Tautulli: " + str(response.status))
            all_user_data = await response.json()
            for user in all_user_data['response']['data']:
                if user['username'] != 'Local':
                    users.append(user['username'])
            self.tautulli_users = users
            logger(self.tautulli_users)

        except (asyncio.TimeoutError, aiohttp.ClientError, socket.gaierror,
                AttributeError) as error:
            msg = "Can not load data from Tautulli: {} - {}".format(url, error)
            logger(msg, 40)
797451
def get_shutit_pexpect_sessions():
	
	sessions = []
	for shutit_object in shutit_global_object.shutit_objects:
		for key in shutit_object.shutit_pexpect_sessions:
			sessions.append(shutit_object.shutit_pexpect_sessions[key])
	return sessions
1093629
def get_all_clients(self, params=None):
        
        return self._iterate_through_pages(
            get_function=self.get_clients_per_page,
            resource=CLIENTS,
            **{'params': params}
        )
685959
def user_list(**connection_args):
    '''
    
    '''
    dbc = _connect(**connection_args)
    if dbc is None:
        return []
    cur = dbc.cursor(MySQLdb.cursors.DictCursor)
    try:
        qry = 'SELECT User,Host FROM mysql.user'
        _execute(cur, qry)
    except MySQLdb.OperationalError as exc:
        err = 'MySQL Error {0}: {1}'.format(*exc.args)
        __context__['mysql.error'] = err
        log.error(err)
        return []
    results = cur.fetchall()
    log.debug(results)
    return results
814990
def session(connection_string=None):
    """"""
    global _session_makers
    connection_string = connection_string or oz.settings["db"]

    if not connection_string in _session_makers:
        _session_makers[connection_string] = sessionmaker(bind=engine(connection_string=connection_string))

    return _session_makers[connection_string]()
1077946
def session(self):
        
        if self._session is None:
            self._session = self.client.create_session()

        return self._session
66178
def get_all_users(path_prefix='/', region=None, key=None, keyid=None,
                 profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    if not conn:
        return None
    _users = conn.get_all_users(path_prefix=path_prefix)
    users = _users.list_users_response.list_users_result.users
    marker = getattr(
        _users.list_users_response.list_users_result, 'marker', None
    )
    while marker:
        _users = conn.get_all_users(path_prefix=path_prefix, marker=marker)
        users = users + _users.list_users_response.list_users_result.users
        marker = getattr(
            _users.list_users_response.list_users_result, 'marker', None
        )
    return users
54053
def uniquelogins(sessions):
    
    # sessions = LoginSession.query.order_by(LoginSession.started_at.asc()).all()
    if not sessions:
        return [], [], []
    dates = {}
    for session in sessions:
        user = session.user
        # time value is discarded to aggregate on days only
        date = session.started_at.strftime("%Y/%m/%d")

        if date not in dates:
            dates[date] = set()  # we want unique users on a given day
            dates[date].add(user)
        else:
            dates[date].add(user)

    daily = []
    weekly = []
    monthly = []

    for date in sorted(dates.keys()):
        # print u"{} : {}".format(date, len(dates[date]))
        date_epoch = unix_time_millis(datetime.strptime(date, "%Y/%m/%d"))
        daily.append({"x": date_epoch, "y": len(dates[date])})

    # first_day = data[0]['x']
    # last_day = data[-1]['x']

    daily_serie = pd.Series(dates)
    # convert the index to Datetime type
    daily_serie.index = pd.DatetimeIndex(daily_serie.index)
    # calculate the values instead of users lists
    daily_serie = daily_serie.apply(lambda x: len(x))

    # GroupBy Week/month, Thanks Panda
    weekly_serie = daily_serie.groupby(pd.Grouper(freq="W")).aggregate(numpysum)
    monthly_serie = daily_serie.groupby(pd.Grouper(freq="M")).aggregate(numpysum)

    for date, value in weekly_serie.items():
        try:
            value = int(value)
        except ValueError:
            continue
        date_epoch = unix_time_millis(date)
        weekly.append({"x": date_epoch, "y": value})

    for date, value in monthly_serie.items():
        try:
            value = int(value)
        except ValueError:
            continue
        date_epoch = unix_time_millis(date)
        monthly.append({"x": date_epoch, "y": value})

    return daily, weekly, monthly
932327
private int listSessions() throws IOException {
    try {
      ClusterManagerService.Client client = getCMSClient();
      List<RunningSession> sessions;
      try {
        sessions = client.getSessions();
      } catch (SafeModeException e) {
        throw new IOException(
          "Cannot list sessions, ClusterManager is in Safe Mode");
      }
      System.out.printf("%d sessions currently running:\n",
          sessions.size());
      System.out.printf("SessionID\t" +
          "Session Name\t" +
          "Session User\t" +
          "Session Poolgroup\t" +
          "Session Pool\t" +
          "Session Priority\t" +
          "Running Mappers\t" +
          "Running Reducers\t" +
          "Running Jobtrackers\n");
      for (RunningSession session : sessions) {
        SessionPriority priority = session.getPriority();
        if (priority == null) {
          priority = SessionPriority.NORMAL;
        }
        System.out.printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",
            session.getHandle(),
            session.getName().replace("\t", "\\t").replace("\n", "\\n"),
            session.getUserId(),
            session.getPoolInfo().getPoolGroupName(),
            session.getPoolInfo().getPoolName(),
            priority,
            session.getRunningResources().get(ResourceType.MAP),
            session.getRunningResources().get(ResourceType.REDUCE),
            session.getRunningResources().get(ResourceType.JOBTRACKER));
      }
    } catch (TException e) {
      throw new IOException(e);
    }

    return 0;
  }
1069294
def get_all_users(self):
		""""""
		
		r = requests.get(api_url+'users/', headers=self.headers)
		print(request_status(r))
		r.raise_for_status()
		output = r.json()
		result = []
		for x in output:
			result.append(User(x))
		return result
228154
static function sessionCleanup()
    {
        $http = eZHTTPTool::instance();

        $valueList = array( self::AVAILABLE_ARRAY,
                            self::STEP,
                            self::USER_INFO,
                            self::LAST_CHECK_REDIRECT,
                            self::FORCE_LOGIN );

        foreach ( $valueList as $value )
        {
            if ( $http->hasSessionVariable( $value ) )
            {
                $http->removeSessionVariable( $value );
            }
        }

        $ini = eZINI::instance();
        $handlerList = array( 'standard' );
        if ( $ini->hasVariable( 'UserSettings', 'LoginHandler' ) )
        {
            $handlerList = $ini->variable( 'UserSettings', 'LoginHandler' );
        }

        foreach( $handlerList as $handler )
        {
            $loginHandler = eZUserLoginHandler::instance( $handler );
            if ( $loginHandler )
            {
                $loginHandler->sessionCleanup();
            }
        }
    }
782730
def list_users(self):
    
        '''  '''
        
    # construct url
        url = self.bucket_url + '/_user/'

    # send request and unwrap response
        response = requests.get(url)
        response = response.json()

        return response
1189133
async def get_user_data(self):
        """"""
        userdata = {}
        sessions = self.session_data.get('sessions', {})
        try:
            async with async_timeout.timeout(8, loop=self._loop):
                for username in self.tautulli_users:
                    userdata[username] = {}
                    userdata[username]['Activity'] = None
                    for session in sessions:
                        if session['username'].lower() == username.lower():
                            userdata[username]['Activity'] = session['state']
                            for key in session:
                                if key != 'Username':
                                    userdata[username][key] = session[key]
                            break

            self.tautulli_user_data = userdata
        except (asyncio.TimeoutError, aiohttp.ClientError, KeyError):
            msg = "Can not load data from Tautulli."
            logger(msg, 40)