66
77from typing import Any , Dict , Iterable , Iterator , List , Optional , Sequence , Union
88
9+ import can .typechecking
10+
911from abc import ABCMeta , abstractmethod
1012import can
1113import logging
@@ -43,7 +45,7 @@ class BusABC(metaclass=ABCMeta):
4345 def __init__ (
4446 self ,
4547 channel : Any ,
46- can_filters : Optional [List [ Dict [ str , Union [ bool , int , str ]]]] = None ,
48+ can_filters : Optional [can . typechecking . CanFilters ] ,
4749 ** kwargs : object
4850 ):
4951 """Construct and open a CAN bus instance of the specified type.
@@ -317,12 +319,10 @@ def filters(self) -> Optional[Iterable[dict]]:
317319 return self ._filters
318320
319321 @filters .setter
320- def filters (self , filters : Optional [Iterable [ Dict [ str , Union [ bool , int , str ]]] ]):
322+ def filters (self , filters : Optional [can . typechecking . CanFilters ]):
321323 self .set_filters (filters )
322324
323- def set_filters (
324- self , filters : Optional [Iterable [Dict [str , Union [bool , int , str ]]]] = None
325- ):
325+ def set_filters (self , filters : Optional [can .typechecking .CanFilters ]):
326326 """Apply filtering to all messages received by this Bus.
327327
328328 All messages that match at least one filter are returned.
@@ -347,9 +347,7 @@ def set_filters(
347347 self ._filters = filters or None
348348 self ._apply_filters (self ._filters )
349349
350- def _apply_filters (
351- self , filters : Optional [Iterable [Dict [str , Union [bool , int , str ]]]]
352- ):
350+ def _apply_filters (self , filters : Optional [can .typechecking .CanFilters ]):
353351 """
354352 Hook for applying the filters to the underlying kernel or
355353 hardware if supported/implemented by the interface.
0 commit comments