SNN2.src.io.files module

files module

Use this module to handle files

class SNN2.src.io.files.FileHandler(filepath: str, create: bool = True)

Bases: object

FileHandler. Class to manage single files

static detect(dir: DirectoryHandler) List[FileHandler]
static exists(filepath: str) bool

exists. Return if a file exists or not

Parameters:

filepath (str) – filepath

Return type:

bool

static extend_path(path: str, extend: str) str
property folderPath: str

folderPath. Get the folder path of a file

Return type:

str the path to the file, without the file, only the folders

get(extension: str) str

get. Permits to get a file path with the same file name as the handled one plus an appendix, remember the type of the file, the part after the ‘.’ will be removed

Parameters:

extension (str) – string to use instead of the default desinence of the file

Return type:

str the filepath modified

static hash_path(path: str, hash: str | None = None) str
property path: str

path.

Returns:

the complete file path to the destination file

Return type:

str