Skip to content

Commit

Permalink
With merge conflict resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenning committed Oct 10, 2023
2 parents 6f50f20 + da07e58 commit 7312e10
Show file tree
Hide file tree
Showing 23 changed files with 348 additions and 138 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ build
tags
.tox
.undodir

go.sum
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
- Summary:
- Insert something here

## Version: 1.8.0

- Released: 2023-10-09
- Summary:
- Rewrite 'dev_tools/deploy_docs.py' as 'dev_tools/deploy_docs' in go
- Disable better_exceptions

## Version: 1.7.25

- Released: 2023-07-10
Expand Down Expand Up @@ -1791,3 +1798,5 @@
- Summary:
- Revised APIs
- Existing APIs should be stable now


11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ copies of CiscoConfParse source-code must also be licensed as GPLv3][45].
Dear [Cisco Systems][27]: please consider porting your improvements back into
the [`github ciscoconfparse repo`](https://github.com/mpenning/ciscoconfparse).

Dependencies
------------

- [Python 3](https://python.org/)
- [passlib](https://github.com/glic3rinu/passlib)
- [toml](https://github.com/uiri/toml)
- [dnspython](https://github.com/rthalley/dnspython)
- [loguru](https://github.com/Delgan/loguru)
- [deprecated](https://github.com/tantale/deprecated)
- [better-exceptions](https://github.com/Qix-/better-exceptions)

Is this a tool, or is it artwork?
---------------------------------

Expand Down
9 changes: 4 additions & 5 deletions ciscoconfparse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@

import sys


import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()
if False:
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()

from ciscoconfparse.ccp_util import PythonOptimizeCheck
from ciscoconfparse.ciscoconfparse import *
Expand Down
9 changes: 5 additions & 4 deletions ciscoconfparse/ccp_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
import inspect
import re

import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()
if False:
import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()

from ciscoconfparse.ccp_util import junos_unsupported
from loguru import logger
Expand Down
24 changes: 9 additions & 15 deletions ciscoconfparse/ccp_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,17 @@
from ipaddress import collapse_addresses as ipaddr_collapse_addresses
from ipaddress import AddressValueError

import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()
if False:
import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()

from dns.exception import DNSException
from dns.resolver import Resolver
from dns import reversename, query, zone

from deprecat import deprecat
from deprecated import deprecated

from loguru import logger

Expand Down Expand Up @@ -1250,13 +1251,6 @@ def __contains__(self, val):
# return (self.network <= val.network) and (
# self.broadcast >= val.broadcast
# )
logger.debug(self.__repr__())
logger.debug(self.as_decimal_network)
logger.debug(self.numhosts)
logger.debug("---------------------------------")
logger.debug(val.__repr__())
logger.debug(val.as_decimal_network)
logger.debug(val.numhosts)
return (self.as_decimal_network <= val.as_decimal_network) and (self.as_decimal_broadcast >= val.as_decimal_broadcast) and (self.prefixlen <= val.prefixlen)

except ValueError as eee:
Expand Down Expand Up @@ -2794,7 +2788,7 @@ def dns_query(input_str="", query_type="", server="", timeout=2.0):


@logger.catch(reraise=True)
@deprecat(reason="dns_lookup() is obsolete; use dns_query() instead. dns_lookup() will be removed", version='1.7.0')
@deprecated(reason="dns_lookup() is obsolete; use dns_query() instead. dns_lookup() will be removed", version='1.7.0')
def dns_lookup(input_str, timeout=3, server="", record_type="A"):
"""Perform a simple DNS lookup, return results in a dictionary"""
if not isinstance(input_str, str):
Expand Down Expand Up @@ -2848,7 +2842,7 @@ def dns_lookup(input_str, timeout=3, server="", record_type="A"):


@logger.catch(reraise=True)
@deprecat(reason="dns6_lookup() is obsolete; use dns_query() instead. dns6_lookup() will be removed", version='1.7.0')
@deprecated(reason="dns6_lookup() is obsolete; use dns_query() instead. dns6_lookup() will be removed", version='1.7.0')
def dns6_lookup(input_str, timeout=3, server=""):
"""Perform a simple DNS lookup, return results in a dictionary"""
rr = Resolver()
Expand Down Expand Up @@ -2907,7 +2901,7 @@ def check_valid_ipaddress(input_addr=None):


@logger.catch(reraise=True)
@deprecat(reason="reverse_dns_lookup() is obsolete; use dns_query() instead. reverse_dns_lookup() will be removed", version='1.7.0')
@deprecated(reason="reverse_dns_lookup() is obsolete; use dns_query() instead. reverse_dns_lookup() will be removed", version='1.7.0')
def reverse_dns_lookup(input_str, timeout=3.0, server="4.2.2.2", proto="udp"):
"""Perform a simple reverse DNS lookup on an IPv4 or IPv6 address; return results in a python dictionary"""
if not isinstance(proto, str) and (proto=="udp" or proto=="tcp"):
Expand Down
15 changes: 8 additions & 7 deletions ciscoconfparse/ciscoconfparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@
import re
import os

import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()
if False:
import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()

from ciscoconfparse.models_cisco import IOSHostnameLine, IOSRouteLine
from ciscoconfparse.models_cisco import IOSIntfLine
Expand Down Expand Up @@ -91,7 +92,7 @@
# Not using ccp_re yet... still a work in progress
# from ciscoconfparse.ccp_util import ccp_re

from deprecat import deprecat
from deprecated import deprecated
from loguru import logger
import toml

Expand Down Expand Up @@ -3119,7 +3120,7 @@ def re_match_iter_typed(

# This method is on CiscoConfParse()
@logger.catch(reraise=True)
@deprecat(
@deprecated(
reason="req_cfgspec_all_diff() is obsolete; use HDiff() instead. req_cfgspec_all_diff() will be removed",
version="1.7.0",
)
Expand Down Expand Up @@ -3191,7 +3192,7 @@ def req_cfgspec_all_diff(self, cfgspec, ignore_ws=False):

# This method is on CiscoConfParse()
@logger.catch(reraise=True)
@deprecat(
@deprecated(
reason="req_cfgspec_excl_diff() is obsolete; use HDiff() instead. req_cfgspec_excl_diff() will be removed",
version="1.7.0",
)
Expand Down
9 changes: 5 additions & 4 deletions ciscoconfparse/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
mike [~at~] pennington [/dot\] net
"""

import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()
if False:
import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()

class BaseError(Exception):
def __init__(self, msg=""):
Expand Down
9 changes: 5 additions & 4 deletions ciscoconfparse/models_asa.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@

import re

import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()
if False:
import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()

from ciscoconfparse.protocol_values import (
ASA_TCP_PORTS,
Expand Down
9 changes: 5 additions & 4 deletions ciscoconfparse/models_cisco.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
import traceback
import re

import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()
if False:
import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()

from ciscoconfparse.errors import DynamicAddressException

Expand Down
9 changes: 5 additions & 4 deletions ciscoconfparse/models_iosxr.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
import re
import os

import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()
if False:
import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()

from ciscoconfparse.errors import DynamicAddressException

Expand Down
9 changes: 5 additions & 4 deletions ciscoconfparse/models_junos.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@

import re

import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()
if False:
import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()

from ciscoconfparse.ccp_abc import BaseCfgLine
from ciscoconfparse.ccp_util import IPv4Obj
Expand Down
9 changes: 5 additions & 4 deletions ciscoconfparse/models_nxos.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@

import re

import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()
if False:
import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()

from ciscoconfparse.errors import DynamicAddressException

Expand Down
9 changes: 5 additions & 4 deletions ciscoconfparse/protocol_values.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from __future__ import absolute_import

import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()
if False:
import better_exceptions
better_exceptions.MAX_LENGTH = None
better_exceptions.SUPPORTS_COLOR = True
better_exceptions.hook()

r""" protocol_values.py - Parse, Query, Build, and Modify IOS-style configurations
Expand Down
Loading

0 comments on commit 7312e10

Please sign in to comment.