Return the directory that accumulator data is stored in, creating it if it
    doesn't exist.
772200
def get_accumulator_dir(cachedir):
    '''
    
    '''
    fn_ = os.path.join(cachedir, 'accumulator')
    if not os.path.isdir(fn_):
        # accumulator_dir is not present, create it
        os.makedirs(fn_)
    return fn_
1126953
def _get_cache_file_path(self, cache_dir=None):
        
        if cache_dir is None:
            # Tries to get writable cache dir with fallback to users data dir
            # and temp directory
            cache_dir = self._get_writable_cache_dir()
        else:
            if not os.access(cache_dir, os.W_OK):
                raise CacheFileError("None of cache directories is writable.")

        # get directory for cached file
        return os.path.join(cache_dir, self._CACHE_FILE_NAME)
1290003
def create_cache_directories(self):
        """"""
        if not os.path.isdir(self.package_cache_dir):
            if not os.path.isdir(self.stacker_cache_dir):
                os.mkdir(self.stacker_cache_dir)
            os.mkdir(self.package_cache_dir)
329894
def get_tmpdir():
    
    global __tmpdir
    if __tmpdir is not None:
        return __tmpdir

    __tmpdir = tempfile.mkdtemp(prefix='.tmp.glerbl.', dir=".")
    atexit.register(__clean_tmpdir)

    return __tmpdir
1245612
def _get_directory_path(context):
    """"""
    path = os.path.join(settings.BASE_PATH, 'store')
    path = context.params.get('path', path)
    path = os.path.join(path, context.crawler.name)
    path = os.path.abspath(os.path.expandvars(path))
    try:
        os.makedirs(path)
    except Exception:
        pass
    return path
631210
def _get_default_cache_dir(self):
        

        return os.path.join(os.path.dirname(__file__), self._DATA_DIR)
1064959
def _ensure_directory_exists(self, directory):
        """"""
        if not os.path.lexists(directory):
            os.makedirs(directory)
        return directory
285057
def IsDirectory(self):
    
    if self._stat_object is None:
      self._stat_object = self._GetStat()
    if self._stat_object is not None:
      self.entry_type = self._stat_object.type
    return self.entry_type == definitions.FILE_ENTRY_TYPE_DIRECTORY
43930
def outdir(self, acc=None):
        
        rootdir = self.rootdir()
        outdir = self.get('outdir', acc=acc)
        dir = os.path.join(rootdir, outdir) if rootdir and outdir else None
        if not os.path.exists(dir):
            os.makedirs(dir)
        return dir
215086
def _get_writable_cache_dir(self):
        
        dir_path_data = self._get_default_cache_dir()

        if os.access(dir_path_data, os.W_OK):
            self._default_cache_file = True
            return dir_path_data

        dir_path_user = user_cache_dir(self._URLEXTRACT_NAME)
        if not os.path.exists(dir_path_user):
            os.makedirs(dir_path_user, exist_ok=True)

        if os.access(dir_path_user, os.W_OK):
            return dir_path_user

        dir_path_temp = tempfile.gettempdir()
        if os.access(dir_path_temp, os.W_OK):
            return dir_path_temp

        raise CacheFileError("Cache directories are not writable.")
480315
def directory(cls, prefix=None):
        
        prefix = prefix or utility.read_config().directory
        name = cls.__name__.lower()
        directory = os.path.expanduser(os.path.join(prefix, name))
        utility.ensure_directory(directory)
        return directory
1293877
def receiver_directory(self):
        """"""
        if self._receiver_directory is None:
            self._receiver_directory = self.downloads_directory.parent
        return self._receiver_directory
704306
def get_datadir():
    
    datadir = os.environ.get('OQ_DATADIR')
    if not datadir:
        shared_dir = config.directory.shared_dir
        if shared_dir:
            datadir = os.path.join(shared_dir, getpass.getuser(), 'oqdata')
        else:  # use the home of the user
            datadir = os.path.join(os.path.expanduser('~'), 'oqdata')
    return datadir
1374520
def directory(self, query, **kwargs):
        """"""
        if isinstance(query, dict):
            query = str(query).replace("'", '"')

        return self.__call_api_get('directory', query=query, kwargs=kwargs)
285275
def get_data_files_dir():
    
    if 'data_files' in os.listdir(sys.prefix):
        return os.path.join(sys.prefix, 'data_files')
    else:
        return os.path.join(get_pmag_dir(), 'data_files')
825072
def prepare_storage_dir(storage_directory):
    """"""
    storage_directory = os.path.expanduser(storage_directory)
    if not os.path.exists(storage_directory):
        os.mkdir(storage_directory)

    return storage_directory
1334499
def directory(self):
        """"""
        if self._directory is None:
            return self.service_group.hitch_dir.hitch_dir
        else:
            return self._directory