kopia lustrzana https://github.com/Yakifo/amqtt
PEP8
rodzic
84adc1d693
commit
a5ed7f47f9
|
@ -7,6 +7,7 @@ from hbmqtt.errors import CodecException, MQTTException
|
||||||
from hbmqtt.codecs import *
|
from hbmqtt.codecs import *
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
|
|
||||||
class PacketType(Enum):
|
class PacketType(Enum):
|
||||||
RESERVED_0 = 0
|
RESERVED_0 = 0
|
||||||
CONNECT = 1
|
CONNECT = 1
|
||||||
|
@ -29,6 +30,7 @@ class PacketType(Enum):
|
||||||
def get_packet_type(byte):
|
def get_packet_type(byte):
|
||||||
return PacketType(byte)
|
return PacketType(byte)
|
||||||
|
|
||||||
|
|
||||||
class MQTTFixedHeader:
|
class MQTTFixedHeader:
|
||||||
def __init__(self, packet_type, flags=0, length=0):
|
def __init__(self, packet_type, flags=0, length=0):
|
||||||
if isinstance(packet_type, int):
|
if isinstance(packet_type, int):
|
||||||
|
@ -77,6 +79,7 @@ class MQTTFixedHeader:
|
||||||
Read and decode MQTT message fixed header from stream
|
Read and decode MQTT message fixed header from stream
|
||||||
:return: FixedHeader instance
|
:return: FixedHeader instance
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def decode_message_type(byte):
|
def decode_message_type(byte):
|
||||||
byte_type = (bytes_to_int(byte) & 0xf0) >> 4
|
byte_type = (bytes_to_int(byte) & 0xf0) >> 4
|
||||||
return PacketType(byte_type)
|
return PacketType(byte_type)
|
||||||
|
@ -153,7 +156,8 @@ class MQTTPayload:
|
||||||
@classmethod
|
@classmethod
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
@abc.abstractclassmethod
|
@abc.abstractclassmethod
|
||||||
def from_stream(cls, reader: asyncio.StreamReader, fixed_header: MQTTFixedHeader, variable_header: MQTTVariableHeader):
|
def from_stream(cls, reader: asyncio.StreamReader, fixed_header: MQTTFixedHeader,
|
||||||
|
variable_header: MQTTVariableHeader):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue