add readme & docstrings
This commit is contained in:
21
parsers.py
21
parsers.py
@@ -13,10 +13,31 @@ from model import Transaction
|
||||
class TransactionParser(ABC):
|
||||
@abstractmethod
|
||||
def match(self, msg: Message) -> bool:
|
||||
"""
|
||||
Determines if the given email message matches the criteria for this parser.
|
||||
|
||||
Args:
|
||||
msg (Message): The email message to evaluate.
|
||||
|
||||
Returns:
|
||||
bool: True if the message matches the parser's criteria, False otherwise.
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def extract(self, msg: EmailMessage) -> Transaction:
|
||||
"""
|
||||
Extracts transaction details from the given email message.
|
||||
|
||||
Args:
|
||||
msg (EmailMessage): The email message to parse.
|
||||
|
||||
Returns:
|
||||
Transaction: A Transaction object containing the extracted details.
|
||||
|
||||
Raises:
|
||||
TransactionParsingFailed: If the message cannot be parsed successfully.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user