43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from typing import Any, Optional, Self
|
|
from abc import ABC, abstractmethod
|
|
from Models.HashModel import HashModel
|
|
|
|
class FilesInterface(ABC):
|
|
|
|
def __init__(self:Self,
|
|
cxcv:Any,
|
|
path:str,
|
|
inputs:Optional[dict[str, Any|None]|list[Any|None]|tuple[Any|None, ...]] = None
|
|
) -> None:
|
|
self.is_file:bool = None
|
|
self.is_directory:bool = None
|
|
self.exists:bool = None
|
|
self.size:int = None
|
|
self.path:str = None
|
|
self.chunk_size:int = None
|
|
self.reusable:bool = None
|
|
self.hash:HashModel = None
|
|
|
|
@abstractmethod
|
|
def open(self:Self, new_path:Optional[str] = None) -> Self:pass
|
|
|
|
@abstractmethod
|
|
def close(self:Self) -> Self:pass
|
|
|
|
@abstractmethod
|
|
def load(self:Self, all:bool = False) -> bytes:pass
|
|
|
|
@abstractmethod
|
|
def save(self:Self, chunk:Optional[bytes|bool] = None) -> None:pass
|
|
|
|
@abstractmethod
|
|
def list(self:Self) -> list[str]:pass
|
|
|
|
@abstractmethod
|
|
def remove(self:Self) -> None:pass
|
|
|
|
@abstractmethod
|
|
def reset(self:Self) -> Self:pass |