We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 77b0375 commit bd1af9aCopy full SHA for bd1af9a
1 file changed
plugwise_usb/helpers/util.py
@@ -7,14 +7,19 @@
7
import crcmod
8
9
from ..constants import HW_MODELS
10
+from ..exceptions import NodeError
11
12
crc_fun = crcmod.mkCrcFun(0x11021, rev=False, initCrc=0x0000, xorOut=0x0000)
13
14
15
def validate_mac(mac: str) -> bool:
16
"""Validate the supplied string is in a MAC address format."""
- if not re.match("^[A-F0-9]+$", mac):
17
+ try:
18
+ if not re.match("^[A-F0-9]+$", mac):
19
+ return False
20
+ except TypeError:
21
return False
22
+
23
try:
24
_ = int(mac, 16)
25
except ValueError:
0 commit comments