You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
372 B

  1. import abc
  2. from typing import Dict
  3. from pydantic import BaseModel
  4. class BaseData(BaseModel, abc.ABC):
  5. filename: str
  6. meta: Dict = {}
  7. @classmethod
  8. def parse(cls, **kwargs):
  9. return cls.parse_obj(kwargs)
  10. def __hash__(self):
  11. return hash(tuple(self.dict()))
  12. class TextData(BaseData):
  13. text: str
  14. class FileData(BaseData):
  15. pass