1- # Copyright (c) 2012-2019 Roger Light and others
2- #
3- # All rights reserved. This program and the accompanying materials
4- # are made available under the terms of the Eclipse Public License v1.0
5- # and Eclipse Distribution License v1.0 which accompany this distribution.
6- #
7- # The Eclipse Public License is available at
8- # http://www.eclipse.org/legal/epl-v10.html
9- # and the Eclipse Distribution License is available at
10- # http://www.eclipse.org/org/documents/edl-v10.php.
11- #
12- # Contributors:
13- # Roger Light - initial API and implementation
14- # Ian Craggs - MQTT V5 support
15-
161import logging
172from typing import Any , Callable , Dict , List , Optional , Tuple , Union
183
@@ -57,45 +42,17 @@ MQTT_ERR_UNKNOWN: int = 13
5742MQTT_ERR_ERRNO : int = 14
5843MQTT_ERR_QUEUE_SIZE : int = 15
5944
60-
61- def connack_string (connack_code : int ) -> str :
62- ...
63-
64-
65- def topic_matches_sub (sub : str , topic : str ) -> bool :
66- ...
67-
45+ def connack_string (connack_code : int ) -> str : ...
46+ def topic_matches_sub (sub : str , topic : str ) -> bool : ...
6847
6948class MQTTMessageInfo (object ):
7049 mid : int
7150 rc : int
72-
73- def __init__ (self , mid : int ) -> None :
74- ...
75-
76- def wait_for_publish (self ) -> None :
77- ...
78-
79- def is_published (self ) -> bool :
80- ...
81-
51+ def __init__ (self , mid : int ) -> None : ...
52+ def wait_for_publish (self ) -> None : ...
53+ def is_published (self ) -> bool : ...
8254
8355class MQTTMessage (object ):
84- """This is a class that describes an incoming or outgoing message. It is
85- passed to the on_message callback as the message parameter.
86-
87- Members:
88-
89- topic : String/bytes. topic that the message was published on.
90- payload : String/bytes the message payload.
91- qos : Integer. The message Quality of Service 0, 1 or 2.
92- retain : Boolean. If true, the message is a retained message and not fresh.
93- mid : Integer. The message id.
94- properties: Properties class. In MQTT v5.0, the properties associated with the message.
95-
96- On Python 3, topic must be bytes.
97- """
98-
9956 timestamp : int
10057 state : int
10158 dup : bool
@@ -104,18 +61,11 @@ class MQTTMessage(object):
10461 qos : int
10562 retain : bool
10663 info : MQTTMessageInfo
107-
108- def __init__ (self , mid : int = ..., topic : bytes = ...) -> None :
109- ...
110-
64+ def __init__ (self , mid : int = ..., topic : bytes = ...) -> None : ...
11165 @property
112- def topic (self ) -> str :
113- ...
114-
66+ def topic (self ) -> str : ...
11567 @topic .setter
116- def topic (self , value : str ) -> None :
117- ...
118-
68+ def topic (self , value : str ) -> None : ...
11969
12070class Client (object ):
12171 def __init__ (
@@ -125,9 +75,7 @@ class Client(object):
12575 userdata : Optional [Any ] = ...,
12676 protocol : int = ...,
12777 transport : str = ...,
128- ) -> None :
129- ...
130-
78+ ) -> None : ...
13179 def connect_async (
13280 self ,
13381 host : str ,
@@ -137,106 +85,69 @@ class Client(object):
13785 bind_port : int = ...,
13886 clean_start : int = ...,
13987 properties : Any = ...,
140- ) -> int :
141- ...
142-
143- def reconnect_delay_set (self , min_delay : int = ..., max_delay : int = ...) -> None :
144- ...
145-
88+ ) -> int : ...
89+ def reconnect_delay_set (
90+ self , min_delay : int = ..., max_delay : int = ...
91+ ) -> None : ...
14692 def publish (
14793 self ,
14894 topic : str ,
14995 payload : Optional [Union [int , float , bytes , str ]] = ...,
15096 qos : int = ...,
15197 retain : bool = ...,
15298 properties : Optional [Any ] = ...,
153- ) -> MQTTMessageInfo :
154- ...
155-
99+ ) -> MQTTMessageInfo : ...
156100 def username_pw_set (
157101 self , username : Union [str , None ], password : Optional [str ] = ...
158- ) -> None :
159- ...
160-
161- def is_connected (self ) -> bool :
162- ...
163-
102+ ) -> None : ...
103+ def is_connected (self ) -> bool : ...
164104 def disconnect (
165105 self , reasoncode : Optional [int ] = ..., properties : Optional [Any ] = ...
166- ) -> int :
167- ...
168-
106+ ) -> int : ...
169107 def subscribe (
170108 self ,
171109 topic : str ,
172110 qos : int = ...,
173111 options : Optional [Any ] = ...,
174112 properties : Optional [Any ] = ...,
175- ) -> Tuple [int , int ]:
176- ...
177-
113+ ) -> Tuple [int , int ]: ...
178114 def will_set (
179115 self ,
180116 topic : str ,
181117 payload : Optional [Union [int , float , bytes , str ]] = ...,
182118 qos : int = ...,
183119 retain : bool = ...,
184120 properties : Optional [Any ] = ...,
185- ) -> None :
186- ...
187-
188- def loop_start (self ) -> None :
189- ...
190-
191- def loop_stop (self , force : bool = ...) -> Union [int , bool ]:
192- ...
193-
121+ ) -> None : ...
122+ def loop_start (self ) -> None : ...
123+ def loop_stop (self , force : bool = ...) -> Union [int , bool ]: ...
194124 @property
195- def on_log (self ) -> Union [Callable [[Client , Any , int , Any ], None ], None ]:
196- ...
197-
125+ def on_log (self ) -> Union [Callable [[Client , Any , int , Any ], None ], None ]: ...
198126 @on_log .setter
199- def on_log (self , func : Callable [[Client , Any , int , Any ], None ]) -> None :
200- ...
201-
127+ def on_log (self , func : Callable [[Client , Any , int , Any ], None ]) -> None : ...
202128 @property
203129 def on_connect (
204130 self ,
205- ) -> Union [Callable [[Client , Any , Dict [str , int ], int , Any , Any ], None ], None ]:
206- ...
207-
131+ ) -> Union [Callable [[Client , Any , Dict [str , int ], int , Any , Any ], None ], None ]: ...
208132 @on_connect .setter
209133 def on_connect (
210134 self , func : Callable [[Client , Any , Dict [str , int ], int , Any , Any ], None ]
211- ) -> None :
212- ...
213-
135+ ) -> None : ...
214136 @property
215137 def on_subscribe (
216138 self ,
217139 ) -> Union [
218140 Callable [[Client , Any , int , List [int ], List [Any ], List [Any ]], None ], None
219- ]:
220- ...
221-
141+ ]: ...
222142 @on_subscribe .setter
223143 def on_subscribe (
224144 self , func : Callable [[Client , Any , int , List [int ], List [Any ], List [Any ]], None ]
225- ) -> None :
226- ...
227-
145+ ) -> None : ...
228146 @property
229- def on_message (self ) -> Union [Callable [[Client , Any , MQTTMessage ], None ], None ]:
230- ...
231-
147+ def on_message (self ) -> Union [Callable [[Client , Any , MQTTMessage ], None ], None ]: ...
232148 @on_message .setter
233- def on_message (self , func : Callable [[Client , Any , MQTTMessage ], None ]) -> None :
234- ...
235-
149+ def on_message (self , func : Callable [[Client , Any , MQTTMessage ], None ]) -> None : ...
236150 @property
237- def on_disconnect (self ) -> Union [Callable [[Client , Any , int ], None ], None ]:
238- ...
239-
151+ def on_disconnect (self ) -> Union [Callable [[Client , Any , int ], None ], None ]: ...
240152 @on_disconnect .setter
241- def on_disconnect (self , func : Callable [[Client , Any , int ], None ]) -> None :
242- ...
153+ def on_disconnect (self , func : Callable [[Client , Any , int ], None ]) -> None : ...
0 commit comments