46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from typing import Self, Sequence
|
|
from abc import ABC, abstractmethod
|
|
|
|
class FilesAbstractInterface(ABC):
|
|
|
|
@abstractmethod
|
|
def get_parents(path:str, levels:int = 1) -> list[str]:pass
|
|
|
|
@abstractmethod
|
|
def set_root_paths(self:Self, paths:str|Sequence[str]) -> None:pass
|
|
|
|
@abstractmethod
|
|
def set_slash(self:Self, slash:str) -> None:pass
|
|
|
|
@abstractmethod
|
|
def fix_path(self:Self, path:str) -> str:pass
|
|
|
|
@abstractmethod
|
|
def get_parent(self:Self, path:str) -> str:pass
|
|
|
|
@abstractmethod
|
|
def get_absolute_path(self:Self, path:str) -> str|None:pass
|
|
|
|
@abstractmethod
|
|
def exists(self:Self, path:str) -> bool:pass
|
|
|
|
@abstractmethod
|
|
def is_file(self:Self, path:str) -> bool:pass
|
|
|
|
@abstractmethod
|
|
def is_directory(self:Self, path:str) -> bool:pass
|
|
|
|
@abstractmethod
|
|
def load(self:Self, path:str, mode:str = "r") -> str|bytes|None:pass
|
|
|
|
@abstractmethod
|
|
def make_directory(self:Self, path:str) -> bool:pass
|
|
|
|
@abstractmethod
|
|
def save(self:Self, path:str, content:str|bytes) -> bool:pass
|
|
|
|
@abstractmethod
|
|
def delete(self:Self, path:str) -> bool:pass |