lib.sedna.common.file_ops
¶
FileOps class.
Module Contents¶
Classes¶
This is a class with some class methods |
- class lib.sedna.common.file_ops.FileOps[source]¶
This is a class with some class methods to handle some files or folder.
- classmethod make_dir(*args)[source]¶
Make new a local directory.
- Parameters:
args (*) – list of str path to joined as a new directory to make.
- classmethod clean_folder(target, clean=True)[source]¶
clean the target directories. create path if target not exists, initial path if clean be True
- Parameters:
target (list) – list of str path need to clean.
clean (bool) – clear target if exists.
- classmethod make_base_dir(*args)[source]¶
Make new a base directory.
- Parameters:
args (*) – list of str path to joined as a
new base directory to make.
- classmethod join_path(*args)[source]¶
Join list of path and return.
- Parameters:
args (*) – list of str path to be joined.
- Returns:
joined path str.
- Return type:
str
- classmethod remove_path_prefix(org_str: str, prefix: str)[source]¶
remove the prefix, for converting path in container to path in host.
- classmethod dump_pickle(obj, filename)[source]¶
Dump a object to a file using pickle.
- Parameters:
obj (object) – target object.
filename (str) – target pickle file path.
- classmethod load_pickle(filename)[source]¶
Load a pickle file and return the object.
- Parameters:
filename (str) – target pickle file path.
- Returns:
return the loaded original object.
- Return type:
object or None.
- classmethod copy_folder(src, dst)[source]¶
Copy a folder from source to destination.
- Parameters:
src (str) – source path.
dst (str) – destination path.
- classmethod copy_file(src, dst)[source]¶
Copy a file from source to destination.
- Parameters:
src (str) – source path.
dst (str) – destination path.
- classmethod http_download(src, dst)[source]¶
Download data from http or https web site.
- Parameters:
src (str) – the data path
dst (str) – the data path
- Raises:
FileNotFoundError – if the file path is not exist, an error will raise