# Path: capirca/lib/nacaddr.py
# def IP(ip, comment='', token='', strict=True):
# def _is_subnet_of(a, b):  # pylint: disable=invalid-name
#   def __init__(self, ip_string, comment='', token='', strict=True):
#   def subnet_of(self, other):
#   def supernet_of(self, other):
#   def __deepcopy__(self, memo):
#   def AddComment(self, comment=''):
#   def supernet(self, prefixlen_diff=1):
#   def __init__(self, ip_string, comment='', token='', strict=True):
#   def subnet_of(self, other):
#   def supernet_of(self, other):
#   def __deepcopy__(self, memo):
#   def supernet(self, prefixlen_diff=1):
#   def AddComment(self, comment=''):
# def _InNetList(adders, ip):
# def IsSuperNet(supernets, subnets):
# def CollapseAddrListPreserveTokens(addresses):
# def _SafeToMerge(address, merge_target, check_addresses):
# def _CollapseAddrListInternal(addresses, complements_by_network):
# def CollapseAddrList(addresses, complement_addresses=None):
# def SortAddrList(addresses):
# def RemoveAddressFromList(superset, exclude):
# def AddressListExclude(superset, excludes, collapse_addrs=True):
# class IPv4(ipaddress.IPv4Network):
# class IPv6(ipaddress.IPv6Network):
# class PrefixlenDiffInvalidError(ipaddress.NetmaskValueError):
# 
# Path: capirca/lib/naming.py
# class Error(Exception):
# class NamespaceCollisionError(Error):
# class BadNetmaskTypeError(Error):
# class NoDefinitionsError(Error):
# class ParseError(Error):
# class UndefinedAddressError(Error):
# class UndefinedServiceError(Error):
# class UndefinedPortError(Error):
# class UnexpectedDefinitionTypeError(Error):
# class NamingSyntaxError(Error):
# class _ItemUnit:
# class Naming:
#   def __init__(self, symbol):
#   def __init__(self, naming_dir=None, naming_file=None, naming_type=None):
#   def _CheckUnseen(self, def_type):
#   def GetIpParents(self, query):
#   def GetServiceParents(self, query):
#   def GetNetParents(self, query):
#   def _GetParents(self, query, query_group):
#   def GetNetChildren(self, query):
#   def _GetChildren(self, query, query_group):
#   def _IsIpFormat(self, item):
#   def GetServiceNames(self):
#   def GetService(self, query):
#   def GetPortParents(self, query, proto):
#   def GetServiceByProto(self, query, proto):
#   def GetNetAddr(self, token):
#   def GetNet(self, query):
#   def _Parse(self, defdirectory, def_type):
#   def _ParseFile(self, file_handle, def_type):
#   def ParseServiceList(self, data):
#   def ParseNetworkList(self, data):
#   def _ParseLine(self, line, definition_type):


import argparse
import pprint
import sys
from absl import app
from absl import logging
from capirca.lib import nacaddr
from capirca.lib import naming
      logging.info(' %s', i)
    logging.info('')
    first_obj, sec_obj = options.cmp
    if check_encapsulated('network', first_obj, sec_obj, db):
      logging.info('%s fully encapsulates %s', sec_obj, first_obj)
    else:
      logging.info('%s does _not_ fully encapsulate %s', sec_obj, first_obj)
    # check the other way around.
    if check_encapsulated('network', sec_obj, first_obj, db):
      logging.info('%s fully encapsulates %s', first_obj, sec_obj)
    else:
      logging.info('%s does _not_ fully encapsulate %s', first_obj, sec_obj)

  # if -o
  elif options.obj:
    for obj in options.obj:
      try:
        token, ips = get_nets([obj], db)[0]
      except naming.UndefinedAddressError:
        logging.info('%s is an invalid object', obj)
      else:
        logging.info('%s:', token)
        # convert list of ip objects to strings and sort them
        ips.sort(key=lambda x: int(x.ip))
        p([str(x) for x in ips])

  # if -s
  elif options.svc:
    try:
      results = get_ports(options.svc, db)

# Path: capirca/lib/nacaddr.py
# def IP(ip, comment='', token='', strict=True):
# def _is_subnet_of(a, b):  # pylint: disable=invalid-name
#   def __init__(self, ip_string, comment='', token='', strict=True):
#   def subnet_of(self, other):
#   def supernet_of(self, other):
#   def __deepcopy__(self, memo):
#   def AddComment(self, comment=''):
#   def supernet(self, prefixlen_diff=1):
#   def __init__(self, ip_string, comment='', token='', strict=True):
#   def subnet_of(self, other):
#   def supernet_of(self, other):
#   def __deepcopy__(self, memo):
#   def supernet(self, prefixlen_diff=1):
#   def AddComment(self, comment=''):
# def _InNetList(adders, ip):
# def IsSuperNet(supernets, subnets):
# def CollapseAddrListPreserveTokens(addresses):
# def _SafeToMerge(address, merge_target, check_addresses):
# def _CollapseAddrListInternal(addresses, complements_by_network):
# def CollapseAddrList(addresses, complement_addresses=None):
# def SortAddrList(addresses):
# def RemoveAddressFromList(superset, exclude):
# def AddressListExclude(superset, excludes, collapse_addrs=True):
# class IPv4(ipaddress.IPv4Network):
# class IPv6(ipaddress.IPv6Network):
# class PrefixlenDiffInvalidError(ipaddress.NetmaskValueError):
# 
# Path: capirca/lib/naming.py
# class Error(Exception):
# class NamespaceCollisionError(Error):
# class BadNetmaskTypeError(Error):
# class NoDefinitionsError(Error):
# class ParseError(Error):
# class UndefinedAddressError(Error):
# class UndefinedServiceError(Error):
# class UndefinedPortError(Error):
# class UnexpectedDefinitionTypeError(Error):
# class NamingSyntaxError(Error):
# class _ItemUnit:
# class Naming:
#   def __init__(self, symbol):
#   def __init__(self, naming_dir=None, naming_file=None, naming_type=None):
#   def _CheckUnseen(self, def_type):
#   def GetIpParents(self, query):
#   def GetServiceParents(self, query):
#   def GetNetParents(self, query):
#   def _GetParents(self, query, query_group):
#   def GetNetChildren(self, query):
#   def _GetChildren(self, query, query_group):
#   def _IsIpFormat(self, item):
#   def GetServiceNames(self):
#   def GetService(self, query):
#   def GetPortParents(self, query, proto):
#   def GetServiceByProto(self, query, proto):
#   def GetNetAddr(self, token):
#   def GetNet(self, query):
#   def _Parse(self, defdirectory, def_type):
#   def _ParseFile(self, file_handle, def_type):
#   def ParseServiceList(self, data):
#   def ParseNetworkList(self, data):
#   def _ParseLine(self, line, definition_type):


# Path: tools/cgrep.py
import argparse
import pprint
import sys
from absl import app
from absl import logging
from capirca.lib import nacaddr
from capirca.lib import naming

      logging.info(' %s', i)
    logging.info('')
    first_obj, sec_obj = options.cmp
    if check_encapsulated('network', first_obj, sec_obj, db):
      logging.info('%s fully encapsulates %s', sec_obj, first_obj)
    else:
      logging.info('%s does _not_ fully encapsulate %s', sec_obj, first_obj)
    # check the other way around.
    if check_encapsulated('network', sec_obj, first_obj, db):
      logging.info('%s fully encapsulates %s', first_obj, sec_obj)
    else:
      logging.info('%s does _not_ fully encapsulate %s', first_obj, sec_obj)

  # if -o
  elif options.obj:
    for obj in options.obj:
      try:
        token, ips = get_nets([obj], db)[0]
      except naming.UndefinedAddressError:
        logging.info('%s is an invalid object', obj)
      else:
        logging.info('%s:', token)
        # convert list of ip objects to strings and sort them
        ips.sort(key=lambda x: int(x.ip))
        p([str(x) for x in ips])

  # if -s
  elif options.svc:
    try:
      results = get_ports(options.svc, db)

    except naming.UndefinedServiceError: