File size: 700 Bytes
25f46be a1c7535 4af03fb 25f46be 4af03fb a1c7535 f6a2061 a1c7535 25f46be a1c7535 |
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)
|