File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 12
12
from abc import ABC , abstractmethod
13
13
import random
14
14
15
+
15
16
class AbstractExpert (ABC ):
16
17
"""Abstract class for experts in the blackboard system."""
17
18
@abstractmethod
@@ -20,18 +21,18 @@ def __init__(self, blackboard) -> None:
20
21
21
22
@property
22
23
@abstractmethod
23
- def is_eager_to_contribute (self ):
24
+ def is_eager_to_contribute (self ) -> bool :
24
25
raise NotImplementedError ("Must provide implementation in subclass." )
25
26
26
27
@abstractmethod
27
- def contribute (self ):
28
+ def contribute (self ) -> None :
28
29
raise NotImplementedError ("Must provide implementation in subclass." )
29
30
30
31
31
32
class Blackboard :
32
33
"""The blackboard system that holds the common state."""
33
34
def __init__ (self ) -> None :
34
- self .experts = []
35
+ self .experts : list = [AbstractExpert ]
35
36
self .common_state = {
36
37
"problems" : 0 ,
37
38
"suggestions" : 0 ,
@@ -138,7 +139,7 @@ def main():
138
139
139
140
140
141
if __name__ == "__main__" :
141
- random .seed (1234 ) # for deterministic doctest outputs
142
+ # random.seed(1234) # for deterministic doctest outputs
142
143
import doctest
143
144
144
145
doctest .testmod ()
You can’t perform that action at this time.
0 commit comments