-
Notifications
You must be signed in to change notification settings - Fork 175
Expand file tree
/
Copy pathbatch.py
More file actions
38 lines (28 loc) · 1.01 KB
/
batch.py
File metadata and controls
38 lines (28 loc) · 1.01 KB
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
from abc import abstractmethod
from typing import TypeVar, override
from .base import BaseAction, BaseActionResult
from .types import BatchFieldData
class BaseBatchAction(BaseAction):
@override
def entity_id(self) -> str | None:
return None
@abstractmethod
def entity_ids(self) -> list[str]:
raise NotImplementedError
@abstractmethod
def field_data(self) -> BatchFieldData | None:
"""
Returns batch field data containing the field type and IDs when the
action's targets exist as fields of another entity.
Returns None if these entities are not fields.
"""
raise NotImplementedError
class BaseBatchActionResult(BaseActionResult):
@override
def entity_id(self) -> str | None:
return None
@abstractmethod
def entity_ids(self) -> list[str]:
raise NotImplementedError
TBatchAction = TypeVar("TBatchAction", bound=BaseBatchAction)
TBatchActionResult = TypeVar("TBatchActionResult", bound=BaseBatchActionResult)