Returns the XNAT session and cache dir corresponding to the
        item.
346138
def get_xsession(self, item):
        
        subj_label, sess_label = self._get_item_labels(item)
        with self:
            xproject = self._login.projects[self.project_id]
            try:
                xsubject = xproject.subjects[subj_label]
            except KeyError:
                xsubject = self._login.classes.SubjectData(
                    label=subj_label, parent=xproject)
            try:
                xsession = xsubject.experiments[sess_label]
            except KeyError:
                xsession = self._login.classes.MrSessionData(
                    label=sess_label, parent=xsubject)
                if item.derived:
                    xsession.fields[
                        self.DERIVED_FROM_FIELD] = self._get_item_labels(
                            item, no_from_study=True)[1]
        return xsession
353115
def get_session(self, sid, namespace=None):
        
        return self.server.get_session(
            sid, namespace=namespace or self.namespace)
309185
def get_session_user(session_id, **kwargs):
    

    hydra_session_object = session.SessionObject({}, #This is normally a request object, but in this case is empty
            validate_key=config.get('COOKIES', 'VALIDATE_KEY', 'YxaDbzUUSo08b+'),
            type='file',
            cookie_expires=True,
            data_dir=config.get('COOKIES', 'DATA_DIR', '/tmp'),
            file_dir=config.get('COOKIES', 'FILE_DIR', '/tmp/auth'))

    hydra_session = hydra_session_object.get_by_id(session_id)

    if hydra_session is not None:
        return hydra_session['user_id']

    return None
310188
def get_bins_by_resource(self, *args, **kwargs):
        """"""
        # Implemented from kitosid template for -
        # osid.resource.ResourceBinSession.get_bins_by_resource
        catalogs = self._get_provider_session('resource_bin_session').get_bins_by_resource(*args, **kwargs)
        cat_list = []
        for cat in catalogs:
            cat_list.append(Bin(self._provider_manager, cat, self._runtime, self._proxy))
        return BinList(cat_list)
641195
def histpath(self):
        """"""
        from os import path
        from fortpy import settings
        return path.join(settings.cache_directory, "history")
197308
def cache_path(self, name):
        
        return os.path.join(self._path, self.CACHE_DIR, name)
1043757
def get(self, prefix, url, schema_version=None):
        
        if not self.cache_dir:
            return None

        filename = self._get_cache_file(prefix, url)

        try:
            with open(filename, 'rb') as file:
                item = pickle.load(file)
            if schema_version and schema_version != item.schema:
                LOGGER.debug("Cache get %s %s: Wanted schema %d, got %d",
                             prefix, url,
                             schema_version, item.schema)
                return None
            return item
        except FileNotFoundError:
            pass
        except Exception:  # pylint:disable=broad-except
            _, msg, _ = sys.exc_info()
            LOGGER.warning("Cache get %s %s failed: %s", prefix, url, msg)

        return None
344850
def _get_provider_sessions(self):
        """"""
        agent_key = self._get_agent_key()
        sessions = []
        for session_name in self._provider_sessions[agent_key]:
            sessions.append(self._provider_sessions[agent_key][session_name])
        return sessions
1283757
def _crates_cache() -> str:
    
    return os.environ.get(
        'XDG_CACHE_HOME',
        os.path.join(os.path.expanduser('~'), '.cache', 'cr8', 'crates'))
950832
def get_dir(path, dest, saltenv='base'):
    '''
    
    '''
    src = __context__['fileclient'].cache_dir(
        path,
        saltenv,
        cachedir=os.path.join('salt-ssh', __salt__.kwargs['id_']))
    src = ' '.join(src)
    single = salt.client.ssh.Single(
            __opts__,
            '',
            **__salt__.kwargs)
    ret = single.shell.send(src, dest)
    return not ret[2]
966458
def get_cache(self, namespace, query_hash, length, start, end):
        """"""
        query = 'SELECT start, value FROM gauged_cache WHERE namespace = ? ' \
            'AND hash = ? AND length = ? AND start BETWEEN ? AND ?'
        cursor = self.cursor
        cursor.execute(query, (namespace, query_hash, length, start, end))
        return tuple(cursor.fetchall())
1144236
public function collectGarbage()
    {

        // counter to store the number of removed sessions
        $sessionRemovalCount = 0;

        // iterate over the found session items
        foreach (new \ApcIterator(ApcSessionHandler::APCU_CACHE_TYPE_USER) as $item) {
            // initialize the key
            $key = null;
            // explode the APC item
            extract($item);
            // unpersist the session
            $session = $this->unpersist($key);

            // query whether or not the session has been expired
            if ($this->sessionTimedOut($session)) {
                // if yes, delete the file + raise the session removal count
                $this->delete($key);
                $sessionRemovalCount++;
            }
        }

        // return the number of removed sessions
        return $sessionRemovalCount;
    }
1227998
def get_from_cache(self):
        """"""
        for item in self.rule.output_files:
            dstpath = os.path.join(self.buildroot, item)
            self.linkorcopy(
                self.cachemgr.path_in_cache(item, self._metahash()),
                dstpath)
779749
def get_locals(cls, session, **kwargs):
        
        return cls.find(session,
                        where=(cls.local == True,),
                        order_by=cls.login,
                        **kwargs)
131742
def session_path(cls, project, session):
        """"""
        return google.api_core.path_template.expand(
            'projects/{project}/agent/sessions/{session}',
            project=project,
            session=session,
        )
230524
def __get_session(self):
        
        db_path = self.__get_config().get(ConfigKeys.asset_allocation_database_path)
        self.session = dal.get_session(db_path)
        return self.session
820130
def get_cached_item(self, path):
        
        item_path = '%s/%s' % (
                self.cache_folder,
                path.strip('/')
            )

        try:
            f = tempfile.NamedTemporaryFile()
            self.blob_service.get_blob_to_path(self.container_name, item_path, f.name)
            f.seek(0)
            image = Image.open(f.name)
            f.close()

            return image
        except AzureMissingResourceHttpError:
            return False