@@ -41,7 +41,6 @@ def _get_single_mapping(controller: BaseController) -> SingleMapping:
4141 scan_methods : dict [str , Scan ] = {}
4242 put_methods : dict [str , Put ] = {}
4343 command_methods : dict [str , Command ] = {}
44- attributes : dict [str , Attribute ] = {}
4544 for attr_name in dir (controller ):
4645 attr = getattr (controller , attr_name )
4746 match attr :
@@ -51,8 +50,26 @@ def _get_single_mapping(controller: BaseController) -> SingleMapping:
5150 scan_methods [attr_name ] = scan_method
5251 case WrappedMethod (fastcs_method = Command (enabled = True ) as command_method ):
5352 command_methods [attr_name ] = command_method
54- case Attribute (enabled = True ):
55- attributes [attr_name ] = attr
53+
54+ attributes : dict [str , Attribute ] = {}
55+ for name in dir (type (controller )):
56+ if isinstance ((attr := getattr (controller , name , None )), Attribute ):
57+ attributes [name ] = attr
58+
59+ object_defined_attributes = controller .get_attributes ()
60+
61+ if conflicting_keys := {
62+ key
63+ for key in object_defined_attributes .keys () & attributes .keys ()
64+ if object_defined_attributes [key ] is not attributes [key ]
65+ }:
66+ raise TypeError (
67+ f"{ controller } has conflicting attributes between those passed in"
68+ "`get_attributes` and those obtained from the class definition: "
69+ f"{ conflicting_keys } "
70+ )
71+
72+ attributes .update (object_defined_attributes )
5673
5774 return SingleMapping (
5875 controller , scan_methods , put_methods , command_methods , attributes
0 commit comments