Skip to content

Commit 34232de

Browse files
committed
Removed type hints for supporting python3.5 and below
1 parent a1d14ba commit 34232de

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

osdp/_bus.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def run_polling_loop(self):
9191

9292
last_message_sent_time = datetime.now()
9393

94-
reply: Reply = None
94+
reply = None
9595
try:
9696
reply = self.send_command_and_receive_reply(data, command, device)
9797
except:
@@ -136,7 +136,7 @@ def process_reply(self, reply: Reply, device: Device):
136136
self._on_reply_received(reply)
137137

138138
def send_command_and_receive_reply(self, data: bytearray, command: Command, device: Device) -> Reply:
139-
command_data: bytes = None
139+
command_data = None
140140
try:
141141
command_data = command.build_command(device)
142142
except:

osdp/_reply.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@ def __init__(self, data: bytes, connection_id: UUID, issuing_command: Command, d
2323
self._address = data[1] & self.ADDRESS_MASK
2424
self._sequence = data[4] & 0x03
2525

26-
is_using_crc: bool = (data[4] & 0x04)!=0
27-
reply_message_footer_size: int = 2 if is_using_crc else 1
26+
is_using_crc = (data[4] & 0x04)!=0
27+
reply_message_footer_size = 2 if is_using_crc else 1
2828

29-
is_secure_control_block_present: bool = (data[4] & 0x08)!=0
30-
secure_block_size: int = (data[5] & 0xFF) if is_secure_control_block_present else 0
29+
is_secure_control_block_present = (data[4] & 0x08)!=0
30+
secure_block_size = (data[5] & 0xFF) if is_secure_control_block_present else 0
3131
self._security_block_type = (data[6] & 0xFF) if is_secure_control_block_present else 0
3232
self._secure_block_data = data[(self.REPLY_MESSAGE_HEADER_SIZE + 2):][:(secure_block_size-2)] if is_secure_control_block_present else b''
3333

34-
mac_size: int = self.MAC_SIZE if self.is_secure_message else 0
35-
message_length: int = len(data) - (reply_message_footer_size + mac_size)
34+
mac_size = self.MAC_SIZE if self.is_secure_message else 0
35+
message_length = len(data) - (reply_message_footer_size + mac_size)
3636

3737
self._mac = data[message_length:][:mac_size]
3838
self._type = ReplyType(data[self.REPLY_TYPE_INDEX + secure_block_size] & 0xFF)
3939

40-
data_start: int = self.REPLY_MESSAGE_HEADER_SIZE + secure_block_size + 1
41-
data_end: int = - reply_message_footer_size - mac_size
40+
data_start = self.REPLY_MESSAGE_HEADER_SIZE + secure_block_size + 1
41+
data_end = - reply_message_footer_size - mac_size
4242
self._extract_reply_data = data[data_start:data_end]
4343

4444
if self.security_block_type==SecurityBlockType.ReplyMessageWithDataSecurity.value:

0 commit comments

Comments
 (0)