Skip to content

Commit

Permalink
Merge isinstance() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenning committed Oct 13, 2023
1 parent 8458b2f commit dbb9d63
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ciscoconfparse/ccp_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ def captured(self):
# do NOT wrap with @logger.catch(...)
def _get_ipv4(val="", strict=False, stdlib=False, debug=0):
"""Return the requested IPv4 object to the caller. This method heavily depends on IPv4Obj()"""
if not (isinstance(val, str) or isinstance(val, int)):
if not (isinstance(val, (str, int)):
raise ValueError

if not isinstance(strict, bool):
Expand Down Expand Up @@ -678,7 +678,7 @@ def _get_ipv4(val="", strict=False, stdlib=False, debug=0):
# do NOT wrap with @logger.catch(...)
def _get_ipv6(val="", strict=False, stdlib=False, debug=0):
"""Return the requested IPv6 object to the caller. This method heavily depends on IPv6Obj()"""
if not (isinstance(val, str) or isinstance(val, int)):
if not (isinstance(val, (str, int)):
raise ValueError

if not isinstance(strict, bool):
Expand Down Expand Up @@ -1019,7 +1019,7 @@ def _ipv4_params_dict_DEPERCATED(self, arg, debug=0):
Parse out important IPv4 parameters from arg. This method must run to
completion for IPv4 address parsing to work correctly.
"""
if not (isinstance(arg, str) or isinstance(arg, int) or isinstance(arg, IPv4Obj)):
if not (isinstance(arg, (str, int, IPv4Obj)):
raise ValueError

if isinstance(arg, str):
Expand Down

0 comments on commit dbb9d63

Please sign in to comment.