1
0
mirror of synced 2024-11-22 17:24:23 +01:00
mat2/libmat2/abstract.py

25 lines
549 B
Python
Raw Normal View History

2018-04-01 12:06:50 +02:00
import abc
2018-04-30 23:46:37 +02:00
import os
2018-04-01 12:06:50 +02:00
2018-04-01 12:06:50 +02:00
class AbstractParser(abc.ABC):
2018-03-20 01:20:11 +01:00
meta_list = set()
mimetypes = set()
2018-03-06 23:20:18 +01:00
def __init__(self, filename: str):
self.filename = filename
2018-04-30 23:46:37 +02:00
fname, extension = os.path.splitext(filename)
self.output_filename = fname + '.cleaned' + extension
2018-03-06 23:20:18 +01:00
2018-04-01 12:06:50 +02:00
@abc.abstractmethod
2018-04-01 01:04:06 +02:00
def get_meta(self) -> dict:
2018-04-01 12:06:50 +02:00
pass
2018-03-06 23:20:18 +01:00
2018-04-01 12:06:50 +02:00
@abc.abstractmethod
2018-04-01 01:04:06 +02:00
def remove_all(self) -> bool:
2018-04-01 12:06:50 +02:00
pass
2018-04-14 21:23:31 +02:00
def remove_all_lightweight(self) -> bool:
""" Remove _SOME_ metadata. """
return self.remove_all()