Skip to content

service

dandy.file.service

FileService

Bases: BaseService['dandy.file.mixin.FileServiceMixin']

Source code in dandy/core/service/service.py
def __init__(self, obj: T_co) -> None:
    self.recorder_event_id = generate_recorder_event_id()
    self.obj = obj

    self.__post_init__()

append staticmethod

Source code in dandy/file/service.py
@staticmethod
def append(file_path: Path | str, content: str):
    utils.append_to_file(file_path, content)

exists staticmethod

Source code in dandy/file/service.py
@staticmethod
def exists(file_path: Path | str) -> bool:
    return utils.file_exists(file_path)

make_directory staticmethod

Source code in dandy/file/service.py
@staticmethod
def make_directory(directory_path: Path | str):
    utils.make_directory(directory_path)

mkdir

Source code in dandy/file/service.py
def mkdir(self, file_path: Path | str):
    self.make_directory(file_path)

read staticmethod

Source code in dandy/file/service.py
@staticmethod
def read(file_path: Path | str) -> str:
    return utils.read_from_file(file_path)

remove staticmethod

Source code in dandy/file/service.py
@staticmethod
def remove(file_path: Path | str):
    utils.remove_file(file_path)

remove_directory staticmethod

Source code in dandy/file/service.py
@staticmethod
def remove_directory(directory_path: Path | str):
    utils.remove_directory(directory_path)

reset

Source code in dandy/file/service.py
def reset(self):
    pass

rm

Source code in dandy/file/service.py
def rm(self, file_path: Path | str):
    self.remove(file_path)

write staticmethod

Source code in dandy/file/service.py
@staticmethod
def write(file_path: Path | str, content: str):
    utils.write_to_file(file_path, content)