Files
MinerU/magic_pdf/rw/AbsReaderWriter.py
T
icecraftandshenguanlin 40e0827e60 Feat/impl cli (#264)
* feat: refractor cli command

* feat: add docs to describe the output files of cli

* feat: resove review comments

* feat: updat docs about middle.json

---------

Co-authored-by: shenguanlin <shenguanlin@pjlab.org.cn>
2024-08-01 19:21:15 +08:00

18 lines
452 B
Python

from abc import ABC, abstractmethod
class AbsReaderWriter(ABC):
MODE_TXT = "text"
MODE_BIN = "binary"
@abstractmethod
def read(self, path: str, mode=MODE_TXT):
raise NotImplementedError
@abstractmethod
def write(self, content: str, path: str, mode=MODE_TXT):
raise NotImplementedError
@abstractmethod
def read_offset(self, path: str, offset=0, limit=None) -> bytes:
raise NotImplementedError