File size: 700 Bytes
8e6ec01 278b90a c7285af 8e6ec01 c7285af 278b90a d1c4a3a 278b90a 8e6ec01 278b90a |
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 |
from abc import abstractmethod
from typing import Dict
from .artifact import Artifact
from .collections import ListCollection
class Instruction(Artifact):
@abstractmethod
def __call__(self) -> str:
pass
class TextualInstruction(Instruction):
text: str
def __call__(self) -> str:
return self.text
def __repr__(self):
return self.text
class InstructionsList(ListCollection):
def verify(self):
for instruction in self.items:
assert isinstance(instruction, Instruction)
class InstructionsDict(Dict):
def verify(self):
for _key, instruction in self.items():
assert isinstance(instruction, Instruction)
|