mirror of
https://github.com/fuckpiracyshield/component.git
synced 2024-05-20 14:06:19 +02:00
34 lines
565 B
Python
34 lines
565 B
Python
from abc import ABC, abstractmethod
|
|
|
|
class Rule(ABC):
|
|
|
|
"""
|
|
Basic rule class.
|
|
"""
|
|
|
|
errors = []
|
|
|
|
def __init__(self):
|
|
"""
|
|
Initialize errors list.
|
|
"""
|
|
|
|
self.errors = []
|
|
|
|
@abstractmethod
|
|
def __call__(self):
|
|
"""
|
|
Method invoked for the rule processing.
|
|
"""
|
|
|
|
pass
|
|
|
|
def register_error(self, message) -> None:
|
|
"""
|
|
Registers all of the errors occurred during the validation.
|
|
|
|
:param message: error message.
|
|
"""
|
|
|
|
self.errors.append(message)
|