summaryrefslogtreecommitdiffstatshomepage
path: root/src/hydrorollcore/rule.py
blob: a1b07cb97ee04517681c4bb32b942a0c596ce5b2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from abc import ABCMeta, abstractmethod
from enum import Enum

__all__ = ["RuleLoadType", "Rule"]


class RuleLoadType(Enum):
    """The Type Of Rules To Be Loaded"""

    DIR = "dir"
    NAME = "name"
    FILE = "file"
    CLASS = "class"


class Rule(metaclass=ABCMeta):
    """规则基类"""

    name: str
    priority: int = 0

    @abstractmethod
    def __init__(self):
        raise NotImplementedError

    @abstractmethod
    async def run(self):
        raise NotImplementedError