kaishi.core.file
¶
Class definition for reading/writing files of various types.
Module Contents¶
-
class
kaishi.core.file.
File
(basedir: str, relpath: str, filename: str)¶ Class with common methods and members to work with files.
-
__repr__
(self)¶
-
__str__
(self)¶
-
compute_hash
(self)¶ Compute the hash of the file.
- Returns
hash value
-
has_label
(self, label_to_check: str)¶ Check if file has a specific label.
- Parameters
label_to_check (str) – label to look for
- Returns
flag indicating if label is present in the file
- Return type
bool
-
add_label
(self, label_to_add: str)¶ Add a label to a file object.
- Parameters
label_to_add (str) – label to append to the file’s labels
-
remove_label
(self, label_to_remove: str)¶ Remove a label from a file object. If the label is not found, this method does nothing.
- Parameters
label_to_remove (str) – label to remove from the file
-