Detect and return existing legacy storage path.
426390
def get_legacy_storage_path(self):
        
        config_dir = os.path.dirname(
            self.py3_wrapper.config.get("i3status_config_path", "/tmp")
        )
        storage_path = os.path.join(config_dir, "py3status.data")
        if os.path.exists(storage_path):
            return storage_path
        else:
            return None
215098
def archive_path(self, real_path):
        
        if (not self.path_prefix):
            return(real_path)
        else:
            return(os.path.relpath(real_path, self.path_prefix))
1189715
def realpath(path):
    
    if path == '~':
        return userdir

    if path == '/':
        return sysroot

    if path.startswith('/'):
        return os.path.abspath(path)

    if path.startswith('~/'):
        return os.path.expanduser(path)

    if path.startswith('./'):
        return os.path.abspath(os.path.join(os.path.curdir, path[2:]))

    return os.path.abspath(path)
260818
private ArchivePath getNestedPath(ArchivePath fullPath, ArchivePath basePath) {
        final String context = fullPath.get();
        final String baseContent = basePath.get();

        // Remove the base path from the full path
        String nestedArchiveContext = context.substring(baseContent.length());

        return new BasicPath(nestedArchiveContext);
    }
790557
def ensure_versions_dir_exists(tfenv_path):
    """"""
    versions_dir = os.path.join(tfenv_path, 'versions')
    if not os.path.isdir(tfenv_path):
        os.mkdir(tfenv_path)
    if not os.path.isdir(versions_dir):
        os.mkdir(versions_dir)
    return versions_dir
741342
def __get_path(path):
    """"""
    if not os.path.isabs(path):
        path = os.path.join(os.getcwd(), path)

    return os.path.normpath(path)
614883
def rmdir(store, path=None):
    """"""
    path = normalize_storage_path(path)
    if hasattr(store, 'rmdir'):
        # pass through
        store.rmdir(path)
    else:
        # slow version, delete one key at a time
        _rmdir_from_keys(store, path)
1292610
def supplement_filesystem(old_size, user_cap=False):
    """"""
    new_size = old_size
    if user_cap:
        if old_size <= _GiB_to_Byte(1.5):
            new_size = _GiB_to_Byte(3)
        else:
            new_size += _GiB_to_Byte(1.5)
    return int(new_size)
288668
def _get_store_by_name(self, name):
        """"""
        for cls in self.storage_type_map.values():
            filename = os.path.join(self.storage_path,
                                    '{name}.{ending}'.format(
                                        name=name,
                                        ending=cls.file_ending))
            if os.path.exists(filename):
                try:
                    return cls(self.storage_path)
                except:
                    continue
        raise ClusterNotFound(
            "No state file for cluster `{name}` was found in directory `{path}`"
            .format(name=name, path=self.storage_path))
937620
def path(self):
        """"""
        names = []
        obj = self
        while obj:
            names.insert(0, obj.name)
            obj = obj.parent_dir
        sep = self.filesystem._path_separator(self.name)
        if names[0] == sep:
            names.pop(0)
            dir_path = sep.join(names)
            # Windows paths with drive have a root separator entry
            # which should be removed
            is_drive = names and len(names[0]) == 2 and names[0][1] == ':'
            if not is_drive:
                dir_path = sep + dir_path
        else:
            dir_path = sep.join(names)
        dir_path = self.filesystem.absnormpath(dir_path)
        return dir_path
804028
def is_files(self, path):
        """"""
        return self._getReturnCodeCmd([self._hadoop_cmd, 'fs', '-test', '-f', self._full_hdfs_path(path)]) == 0
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
398003
def get_restore_path(filename):
    
    path = os.path.join(RESTORE_DIRECTORY, FILE_STORE_LOCATION)
    if not os.path.exists(path):
        os.makedirs(path)
    return os.path.join(path, filename + '.pickle')
615959
def existing_path(value):
    """"""
    if os.path.exists(value):
        return value
    else:
        raise argparse.ArgumentTypeError("Path {0} not found".format(value))
45851
def IsFileStatEntry(self, original_result):
    """"""
    return (original_result.pathspec.pathtype in [
        rdf_paths.PathSpec.PathType.OS, rdf_paths.PathSpec.PathType.TSK
    ])
855781
def make_gpfs_path(path):
    """"""
    if os.path.isabs(path):
        fullpath = os.path.abspath(path)
    else:
        fullpath = os.path.abspath(path)
    if len(fullpath) < 5:
        return fullpath
    if fullpath[0:5] == '/nfs/':
        fullpath = fullpath.replace('/nfs/', '/gpfs/')
    return fullpath
748719
def old_checksum(self):
        """"""
        if self.context.is_file(self.checksum_file):
            logger.debug("Reading saved checksum from %s ..", format_path(self.checksum_file))
            checksum = self.context.read_file(self.checksum_file).decode('ascii')
            logger.debug("Saved checksum is %s.", checksum)
            return checksum