Skip to content

Commit

Permalink
Heuristics for ActorList.filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Daraan committed Oct 14, 2024
1 parent 3a553d5 commit 546f60c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions PythonAPI/carla/source/carla/libcarla.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,23 @@ class ActorList(Generic[__Actor]):
The list is automatically created and updated by the server and it can be returned using `carla.World`.
"""

# Heuristic to infer type without Generic

@overload
def filter(self, wildcard_pattern: Literal['traffic_light.*']) -> ActorList[TrafficLight]: ...

@overload
def filter(self, wildcard_pattern: Literal['vehicle.*']) -> ActorList[Vehicle]: ...

@overload
def filter(self, wildcard_pattern: Literal['walker.pedestrian.*', 'walker.*']) -> ActorList[Walker]: ...

@overload
def filter(self, wildcard_pattern: Literal['sensor.*']) -> ActorList[Sensor]: ...

@overload
def filter(self, wildcard_pattern: str) -> ActorList[__Actor]: ...

# region Methods
def filter(self, wildcard_pattern: str) -> ActorList[__Actor]:
"""Filters a list of Actors matching wildcard_pattern against their variable `type_id` (which identifies the blueprint used to spawn them). Matching follows fnmatch standard.
Expand Down

0 comments on commit 546f60c

Please sign in to comment.