From e9b013528b10f775b5286f316f55421e505314fe Mon Sep 17 00:00:00 2001 From: mpenning Date: Fri, 1 Dec 2023 09:15:19 -0600 Subject: [PATCH] Remove deprecated method --- ciscoconfparse/ccp_util.py | 74 -------------------------------------- 1 file changed, 74 deletions(-) diff --git a/ciscoconfparse/ccp_util.py b/ciscoconfparse/ccp_util.py index 9b69d27..27be79a 100644 --- a/ciscoconfparse/ccp_util.py +++ b/ciscoconfparse/ccp_util.py @@ -1088,80 +1088,6 @@ def __init__(self, v4input=None, strict=False, debug=0): # nosec f"Could not parse '{v4input}' {type(v4input)} into an IPv4 Address" ) - #################################### NEW - # do NOT wrap with @logger.catch(...) - # On IPv4Obj() - 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, int, IPv4Obj)): - raise ValueError - - if isinstance(arg, str): - try: - mm = _RGX_IPV4ADDR_WITH_MASK.search(arg) - except TypeError: - raise AddressValueError( - f"_ipv4_params_dict() doesn't understand how to parse {arg}" - ) - except BaseException: - raise AddressValueError( - f"_ipv4_params_dict() doesn't understand how to parse {arg}" - ) - - error_msg = f"_ipv4_params_dict() couldn't parse '{arg}'" - if mm is None: - raise RequirementFailure(error_msg) - - mm_result = mm.groupdict() - addr = ( - mm_result["v4addr_nomask"] or mm_result["v4addr_netmask"] or mm_result["v4addr_prefixlen"] - ) - # Normalize if we get zero-padded strings, i.e. 172.001.001.001 - if not re.search(r"^\d+\.\d+.\d+\.\d+", addr): - raise RequirementFailure() - addr = ".".join([str(int(ii)) for ii in addr.split(".")]) - - netmask = mm_result["netmask"] - - masklen = int(mm_result.get("masklen", None) or IPV4_MAX_PREFIXLEN) - - if netmask is not None: - ip_arg_str = f"{addr}/{netmask}" - elif masklen is not None: - ip_arg_str = f"{addr}/{masklen}" - else: - raise AddressValueError() - - elif isinstance(arg, int): - addr = str(IPv4Address(arg)) - netmask = "255.255.255.255" - masklen = 32 - ip_arg_str = f"{addr}/{masklen}" - - elif isinstance(arg, IPv4Obj): - addr = str(arg.ip) - netmask = str(arg.netmask) - masklen = arg.masklen - ip_arg_str = f"{addr}/{masklen}" - - else: - raise AddressValueError("IPv4Obj(arg='%s') is an unknown argument type" % (arg)) - - if not (0 <= masklen <= IPV4_MAX_PREFIXLEN): - raise RequirementFailure() - params_dict = { - 'ipv4_addr': addr, - 'ip_version': 4, - 'ip_arg_str': ip_arg_str, - 'netmask': netmask, - 'masklen': masklen, - } - - return params_dict - # do NOT wrap with @logger.catch(...) # On IPv4Obj() def __repr__(self):