-
Notifications
You must be signed in to change notification settings - Fork 179
/
Copy pathpreprocess_step_performer.py
48 lines (41 loc) · 1.47 KB
/
preprocess_step_performer.py
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
from abc import ABC, abstractmethod
from typing import Any, Dict, Collection, List, Optional, Tuple
from mitosheet.types import StepsManagerType
class PreprocessStepPerformer(ABC, object):
"""
The abstract base class for a preprocess step, which
executes at the start of the analysis on the arguments
passed to the mitosheet.sheet call
"""
@classmethod
@abstractmethod
def preprocess_step_version(cls) -> int:
"""
Returns the version of the step. Changes when the parameters
of the step change.
"""
pass
@classmethod
@abstractmethod
def preprocess_step_type(cls) -> str:
"""
The name of the step used internally. If you change this, you must upgrade
the step and bump the version.
"""
pass
@classmethod
@abstractmethod
def execute(cls, args: Collection[Any], kwargs: Dict[str, Any]) -> Tuple[List[Any], Optional[List[str]], Optional[Dict[str, Any]]]:
"""
Execute always returns the new list of arguments, as well as the names of these arguements, as well as execution_data
for this preprocess step.
"""
pass
@classmethod
@abstractmethod
def transpile(cls, steps_manager: StepsManagerType, execution_data: Optional[Dict[str, Any]]) -> Tuple[List[str], List[str]]:
"""
Returns a list of the Python code lines that corresponds to this
preprocess step being executed
"""
pass