File size: 1,228 Bytes
9411c06
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from abc import ABC

from typing import Any

class Tasker(ABC):
    """The abstract class for taskers."""

    def __init__(self, *args, **kwargs):
        pass

    def pre_do(self, func, *args, **kwargs):
        """
        Pre do before actually do on sample.

        func:
            Wrapped func
        args:
            Positional arguments
        kwargs:
            Keyword arguments
        return:
            Done sample
        """
        raise NotImplemented("The method is not implement")

    def do(self, sample: Any, *args, **kwargs) -> Any:
        """
        Actually do task on sample.

        sample:
            Sample need to process
        args:
            Positional arguments
        kwargs:
            Keyword arguments
        return:
            Done sample
        """
        raise NotImplemented("The method is not implement")

    def post_do(self, sample: Any, *args, **kwargs):
        """
        Post do after do on sample.

        sample:
            Sample need to process
        args:
            Positional arguments
        kwargs:
            Keyword arguments
        return:
            Done sample
        """
        raise NotImplemented("The method is not implement")