259 """ import custom modules dynamically """
260 try:
261 return importlib.import_module(req_module)
262 except (ModuleNotFoundError, ImportError):263 if re_raise:
264 raise
265
Two or more exceptions in the same exception handler clause that are identical or parts of the same inheritance hierarchy (i.e. overlapping). It is recommmend to refactor this.
class SomeException(Exception):
pass
class SubclassException(SomeException):
pass
try:
raise SubclassException()
except (SomeException, SubclassException):
pass
Here, SubclassException
has been derived from SomeException
, which makes it overlapping.
class SomeException(Exception):
pass
class SubclassException(SomeException):
pass
try:
raise SubclassException()
except SomeException:
pass