# 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):


from capirca.lib import naming
    self.destination = []
    self.sport = []
    self.dport = []
    self.action = []
    self.option = []
    self.protocol = []

  def __str__(self):
    rval = []
    rval.append('  Term: %s' % self.name)
    rval.append('  Source-address:: %s' % ' '.join(self.source))
    rval.append('  Destination-address:: %s' % ' '.join(self.destination))
    rval.append('  Source-port:: %s' % ' '.join(self.sport))
    rval.append('  Destination-port:: %s' % ' '.join(self.dport))
    rval.append('  Protocol:: %s' % ' '.join(self.protocol))
    rval.append('  Option:: %s' % ' '.join(self.option))
    rval.append('  Action:: %s' % ' '.join(self.action))
    return '\n'.join(rval)


class Policy:
  """Holds basic attributes of an unexpanded policy definition file."""

  def __init__(self, filename, defs_data=None):
    """Build policy object and naming definitions from provided filenames.

    Args:
      filename: location of a .pol file
      defs_data: location of naming definitions directory, if any
    """

# 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: capirca/lib/policyreader.py
from capirca.lib import naming

    self.destination = []
    self.sport = []
    self.dport = []
    self.action = []
    self.option = []
    self.protocol = []

  def __str__(self):
    rval = []
    rval.append('  Term: %s' % self.name)
    rval.append('  Source-address:: %s' % ' '.join(self.source))
    rval.append('  Destination-address:: %s' % ' '.join(self.destination))
    rval.append('  Source-port:: %s' % ' '.join(self.sport))
    rval.append('  Destination-port:: %s' % ' '.join(self.dport))
    rval.append('  Protocol:: %s' % ' '.join(self.protocol))
    rval.append('  Option:: %s' % ' '.join(self.option))
    rval.append('  Action:: %s' % ' '.join(self.action))
    return '\n'.join(rval)


class Policy:
  """Holds basic attributes of an unexpanded policy definition file."""

  def __init__(self, filename, defs_data=None):
    """Build policy object and naming definitions from provided filenames.

    Args:
      filename: location of a .pol file
      defs_data: location of naming definitions directory, if any
    """

    self.defs = naming.Naming(defs_data)