Base๏
Generic base classes and functions for file operations.
Classes:
|
Generic class for representing a file on a system. |
- class musify.file.base.File๏
Bases:
object
Generic class for representing a file on a system.
Attributes:
Extensions of files that can be loaded by this class.
The path to the file.
The parent folder of the file.
The filename without extension.
The file extension in lowercase.
The size of the file in bytes
datetime
object representing when the file was createddatetime
object representing when the file was last modifiedMethods:
get_filepaths
(folder)Get all files in a given folder that match this File object's valid filetypes recursively.
load
(*args,ย **kwargs)Load the file to this object
save
([dry_run])Save this object to file.
-
valid_extensions:
frozenset
[str
]๏ Extensions of files that can be loaded by this class.
- abstract property path: Path๏
The path to the file.
- property folder: str๏
The parent folder of the file.
- property filename: str๏
The filename without extension.
- property ext: str๏
The file extension in lowercase.
- property size: int | None๏
The size of the file in bytes
- property date_created: datetime | None๏
datetime
object representing when the file was created
- property date_modified: datetime | None๏
datetime
object representing when the file was last modified
- classmethod get_filepaths(folder)๏
Get all files in a given folder that match this File objectโs valid filetypes recursively.
- Return type:
set
[Path
]
- abstract async load(*args, **kwargs)๏
Load the file to this object
- Return type:
Any
- abstract async save(dry_run=True, *args, **kwargs)๏
Save this object to file.
- Parameters:
dry_run (
bool
(default:True
)) โ Run function, but do not modify the file on the disk.- Return type:
Any
-
valid_extensions: