12
12
"""
13
13
14
14
try :
15
- from typing import Any , Callable , Dict , Iterator
15
+ from typing import Dict
16
16
except ImportError :
17
17
pass
18
18
@@ -39,15 +39,15 @@ def __init__(self) -> None:
39
39
def __init__ (self ) -> None :
40
40
self ._root = self .Node ()
41
41
42
- def __setitem__ (self , key : str , value : Callable [..., Any ] ) -> None :
42
+ def __setitem__ (self , key : str , value ) -> None :
43
43
"""Add a topic filter :key to the prefix tree
44
44
and associate it to :value"""
45
45
node = self ._root
46
46
for sym in key .split ("/" ):
47
47
node = node .children .setdefault (sym , self .Node ())
48
48
node .content = value
49
49
50
- def __getitem__ (self , key : str ) -> Callable [..., Any ] :
50
+ def __getitem__ (self , key : str ):
51
51
"""Retrieve the value associated with some topic filter :key"""
52
52
try :
53
53
node = self ._root
@@ -76,13 +76,13 @@ def __delitem__(self, key: str) -> None:
76
76
break
77
77
del parent .children [k ]
78
78
79
- def iter_match (self , topic : str ) -> Iterator [ Callable [..., Any ]] :
79
+ def iter_match (self , topic : str ):
80
80
"""Return an iterator on all values associated with filters
81
81
that match the :topic"""
82
82
lst = topic .split ("/" )
83
83
normal = not topic .startswith ("$" )
84
84
85
- def rec (node : MQTTMatcher .Node , i : int = 0 ) -> Iterator [ Callable [..., Any ]] :
85
+ def rec (node : MQTTMatcher .Node , i : int = 0 ):
86
86
if i == len (lst ):
87
87
if node .content is not None :
88
88
yield node .content
0 commit comments