File size: 706 Bytes
278b90a
 
 
c7285af
 
278b90a
 
 
 
 
 
 
 
 
 
 
 
 
d1c4a3a
 
 
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
35
36
from abc import ABC, abstractmethod
from typing import Dict

from .artifact import Artifact


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


from .collections import ListCollection


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)