Skip to content

Commit 7e58750

Browse files
committed
format with black and isort
1 parent af99b35 commit 7e58750

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

rfid.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def __init__(self, ip, serial):
100100
def little_endian_hex(val):
101101
"""Convert integer to little-endian hex string"""
102102
endian = struct.pack("<I", val)
103-
return binascii.hexlify(endian).decode('utf8')
103+
return binascii.hexlify(endian).decode("utf8")
104104

105105
@staticmethod
106106
def check_valid_ipv4_address(ip):
@@ -154,7 +154,7 @@ def crc_16_ibm(data):
154154
# switch order to little endian and return unsigned short, then
155155
# replace characters in list with the CRC values
156156
endian = struct.pack("<H", code)
157-
data_list[4:8] = binascii.hexlify(endian).decode('utf8')
157+
data_list[4:8] = binascii.hexlify(endian).decode("utf8")
158158

159159
return "".join(data_list)
160160

tests.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from rfid import (RFIDClient, comma_format_to_ten_digit,
66
ten_digit_to_comma_format)
77

8-
98
TEST_CONTROLLER_IP = "192.168.1.20"
109
TEST_CONTROLLER_SERIAL = 123106461
1110
TEST_BADGE = 16935527
@@ -66,20 +65,22 @@ def test_crc_16_ibm(self):
6665
expected_result = "201066f228000000000000009d74560700000200ffffffff"
6766
self.assertEqual(result, expected_result)
6867

69-
@patch("rfid.RFIDClient.connect", return_value=mock_socket([b'\x23\x21', b'\x20\x11']))
68+
@patch(
69+
"rfid.RFIDClient.connect", return_value=mock_socket([b"\x23\x21", b"\x20\x11"])
70+
)
7071
@patch("rfid.RFIDClient.check_valid_ipv4_address")
7172
def test_add_user(self, mock_connect, mock_check_valid_ipv4_address):
7273
rfid_client = RFIDClient(TEST_CONTROLLER_IP, TEST_CONTROLLER_SERIAL)
7374
test_doors = [1, 2]
7475
rfid_client.add_user(TEST_BADGE, test_doors)
7576

76-
@patch("rfid.RFIDClient.connect", return_value=mock_socket([b'\x23\x21']))
77+
@patch("rfid.RFIDClient.connect", return_value=mock_socket([b"\x23\x21"]))
7778
@patch("rfid.RFIDClient.check_valid_ipv4_address")
7879
def test_remove_user(self, mock_connect, mock_check_valid_ipv4_address):
7980
rfid_client = RFIDClient(TEST_CONTROLLER_IP, TEST_CONTROLLER_SERIAL)
8081
rfid_client.remove_user(TEST_BADGE)
8182

82-
@patch("rfid.RFIDClient.connect", return_value=mock_socket([b'\x20\x41']))
83+
@patch("rfid.RFIDClient.connect", return_value=mock_socket([b"\x20\x41"]))
8384
@patch("rfid.RFIDClient.check_valid_ipv4_address")
8485
def test_open_door(self, mock_connect, mock_check_valid_ipv4_address):
8586
rfid_client = RFIDClient(TEST_CONTROLLER_IP, TEST_CONTROLLER_SERIAL)

0 commit comments

Comments
 (0)