1212"""
1313
1414try :
15- from typing import Any , Callable , Dict , Iterator
15+ from typing import Dict
1616except ImportError :
1717 pass
1818
@@ -39,15 +39,15 @@ def __init__(self) -> None:
3939 def __init__ (self ) -> None :
4040 self ._root = self .Node ()
4141
42- def __setitem__ (self , key : str , value : Callable [..., Any ] ) -> None :
42+ def __setitem__ (self , key : str , value ) -> None :
4343 """Add a topic filter :key to the prefix tree
4444 and associate it to :value"""
4545 node = self ._root
4646 for sym in key .split ("/" ):
4747 node = node .children .setdefault (sym , self .Node ())
4848 node .content = value
4949
50- def __getitem__ (self , key : str ) -> Callable [..., Any ] :
50+ def __getitem__ (self , key : str ):
5151 """Retrieve the value associated with some topic filter :key"""
5252 try :
5353 node = self ._root
@@ -76,13 +76,13 @@ def __delitem__(self, key: str) -> None:
7676 break
7777 del parent .children [k ]
7878
79- def iter_match (self , topic : str ) -> Iterator [ Callable [..., Any ]] :
79+ def iter_match (self , topic : str ):
8080 """Return an iterator on all values associated with filters
8181 that match the :topic"""
8282 lst = topic .split ("/" )
8383 normal = not topic .startswith ("$" )
8484
85- def rec (node : MQTTMatcher .Node , i : int = 0 ) -> Iterator [ Callable [..., Any ]] :
85+ def rec (node : MQTTMatcher .Node , i : int = 0 ):
8686 if i == len (lst ):
8787 if node .content is not None :
8888 yield node .content
0 commit comments