From 5a30d9d995e60c9bf08d7e5a9e7215fe3c34be77 Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Fri, 22 Apr 2022 19:40:04 +0000 Subject: [PATCH] Add proper exception classes (pylint) --- config/mac.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/mac.py b/config/mac.py index b42448b..89135b9 100644 --- a/config/mac.py +++ b/config/mac.py @@ -19,7 +19,7 @@ def is_valid(mac): as defined by netaddr.EUI""" try: _addr = netaddr.EUI(mac) - except: + except netaddr.core.AddrFormatError: return False return True @@ -28,7 +28,7 @@ def is_local(mac): """Return True if a MAC address is a valid locally administered one.""" try: addr = netaddr.EUI(mac) - except: + except netaddr.core.AddrFormatError: return False return bool(addr.words[0] & 0b10) @@ -37,7 +37,7 @@ def is_multicast(mac): """Return True if a MAC address is a valid multicast one.""" try: addr = netaddr.EUI(mac) - except: + except netaddr.core.AddrFormatError: return False return bool(addr.words[0] & 0b01) @@ -46,6 +46,6 @@ def is_unicast(mac): """Return True if a MAC address is a valid unicast one.""" try: addr = netaddr.EUI(mac) - except: + except netaddr.core.AddrFormatError: return False return not bool(addr.words[0] & 0b01)