@@ -264,11 +264,10 @@ def valid(self) -> bool:
264
264
"""Check if the vehicle still `exists` and is still operable."""
265
265
return self ._initialized
266
266
267
- @classmethod
268
267
@property
269
- def sensor_names (cls ) -> Tuple [str ]:
268
+ def sensor_names (self ) -> Tuple [str ]:
270
269
"""The names of the sensors that are potentially available to this vehicle."""
271
- return cls ._sensor_names
270
+ return self ._sensor_names
272
271
273
272
@staticmethod
274
273
@lru_cache (maxsize = None )
@@ -467,6 +466,7 @@ def add_sensor_if_needed(
467
466
vehicle .attach_sensor (sensor , sensor_name )
468
467
added_sensors .append ((sensor_name , sensor ))
469
468
469
+ # pytype: disable=attribute-error
470
470
add_sensor_if_needed (TripMeterSensor , sensor_name = "trip_meter_sensor" )
471
471
add_sensor_if_needed (DrivenPathSensor , sensor_name = "driven_path_sensor" )
472
472
if agent_interface .neighborhood_vehicle_states :
@@ -555,6 +555,7 @@ def add_sensor_if_needed(
555
555
"signals_sensor" ,
556
556
lookahead = agent_interface .signals .lookahead ,
557
557
)
558
+ # pytype: enable=attribute-error
558
559
559
560
for sensor_name , sensor in added_sensors :
560
561
if not sensor :
@@ -676,16 +677,12 @@ def _meta_create_instance_sensor_functions(self):
676
677
setattr (
677
678
self ,
678
679
f"attach_{ sensor_name } " ,
679
- partial (
680
- self .__class__ .attach_sensor , self = self , sensor_name = sensor_name
681
- ),
680
+ partial (self .attach_sensor , sensor_name = sensor_name ),
682
681
)
683
682
setattr (
684
683
self ,
685
684
f"detach_{ sensor_name } " ,
686
- partial (
687
- self .__class__ .detach_sensor , self = self , sensor_name = sensor_name
688
- ),
685
+ partial (self .detach_sensor , sensor_name = sensor_name ),
689
686
)
690
687
691
688
@classmethod
0 commit comments