File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import inspect
22from collections .abc import Mapping
3- from typing import Callable , TypeAlias , TypeVar
3+ from types import FunctionType
4+ from typing import TypeAlias , TypeVar
45
56from pcs .component import Component
67
7- System : TypeAlias = Callable [..., None | Mapping [ str , object ]]
8+ System : TypeAlias = FunctionType
89
910T = TypeVar ("T" )
1011
@@ -45,11 +46,14 @@ def check_for_nulls(self, system: System) -> None:
4546 return
4647 for parameter in inspect .signature (system ).parameters :
4748 assert getattr (self .component , parameter ) is not None , (
48- f"System: { system .__name__ } - Parameter { parameter } was None"
49+ f"System: ` { system .__name__ } ` - Parameter ` { parameter } ` was None"
4950 )
5051
5152 def set_component (self , result : None | Mapping [str , object ]) -> None :
5253 if result is None :
5354 return
5455 for name , obj in result .items ():
56+ assert hasattr (self .component , name ), (
57+ f"Component does not have an attribute called: `{ name } `"
58+ )
5559 setattr (self .component , name , obj )
You can’t perform that action at this time.
0 commit comments