# Path: ptp/libptp/constants.py
# UNKNOWN = 0
# 
# Path: ptp/libptp/parser.py
# class LineParser(AbstractParser):
# 
#     """Specialized parser for generic report files.
# 
#     Define the special :func:`handle_file` function in order to process the generic report file.
# 
#     .. note::
# 
#         Contrary to :class:`FileParser`, this class reads the file line by line and return a :class:`list`, instead of
#         a :class:`str`.
# 
#     """
# 
#     @classmethod
#     def handle_file(cls, pathname='./', filename='*', skip_empty=True, first=True):
#         """Return a list of the lines of the file.
# 
#         :param str pathname: Path to the report directory.
#         :param str filename: Regex matching the report file.
#         :param bool first: Stop the search as soon as a file has been matched.
#         :param bool skip_empty: skip the empty lines that can occur in the file if `True`, otherwise keep them.
# 
#         :raises IOError: when the report file cannot be found or an error occurs when opening/reading.
#         :raises OSError: when an error occurs when opening/reading the report file.
# 
#         :return: all the data from the file, line by line.
#         :rtype: list
# 
#         """
#         fullpath = cls._recursive_find(pathname, filename, first=first)
#         if not len(fullpath):
#             raise IOError("Report matching '%s' cannot be found." % filename)
#         data = []
#         for current_file in fullpath:
#             with open(current_file, 'r') as f:
#                 if skip_empty:
#                     data.extend([line.rstrip('\n\r') for line in f.readlines() if line.rstrip('\n\r')])
#                 else:
#                     data.extend([line.rstrip('\n\r') for line in f.readlines()])
#         return data
# 
# Path: ptp/tools/robots/signatures.py
# SIGNATURES = {
#     # Admin interfaces
#     '/phpmyadmin': INFO,
#     '/admin': INFO,
#     '/backend': INFO,
#     '/private': INFO,
#     '/secret': INFO,
#     '/login': INFO,
#     '/logon': INFO}


from ptp.libptp.constants import UNKNOWN
from ptp.libptp.parser import LineParser
from ptp.tools.robots.signatures import SIGNATURES
"""

:synopsis: Specialized :class:`ptp.libptp.parser.AbstractParser` classes for the robots.txt files.

.. moduleauthor:: Tao Sauvage

"""



class RobotsParser(LineParser):
    """Robots specialized parser."""

    __tool__ = 'robots'
    __format__ = 'txt'

    def __init__(self, pathname, filename='*robots.txt', light=False, first=True):

# Path: ptp/libptp/constants.py
# UNKNOWN = 0
# 
# Path: ptp/libptp/parser.py
# class LineParser(AbstractParser):
# 
#     """Specialized parser for generic report files.
# 
#     Define the special :func:`handle_file` function in order to process the generic report file.
# 
#     .. note::
# 
#         Contrary to :class:`FileParser`, this class reads the file line by line and return a :class:`list`, instead of
#         a :class:`str`.
# 
#     """
# 
#     @classmethod
#     def handle_file(cls, pathname='./', filename='*', skip_empty=True, first=True):
#         """Return a list of the lines of the file.
# 
#         :param str pathname: Path to the report directory.
#         :param str filename: Regex matching the report file.
#         :param bool first: Stop the search as soon as a file has been matched.
#         :param bool skip_empty: skip the empty lines that can occur in the file if `True`, otherwise keep them.
# 
#         :raises IOError: when the report file cannot be found or an error occurs when opening/reading.
#         :raises OSError: when an error occurs when opening/reading the report file.
# 
#         :return: all the data from the file, line by line.
#         :rtype: list
# 
#         """
#         fullpath = cls._recursive_find(pathname, filename, first=first)
#         if not len(fullpath):
#             raise IOError("Report matching '%s' cannot be found." % filename)
#         data = []
#         for current_file in fullpath:
#             with open(current_file, 'r') as f:
#                 if skip_empty:
#                     data.extend([line.rstrip('\n\r') for line in f.readlines() if line.rstrip('\n\r')])
#                 else:
#                     data.extend([line.rstrip('\n\r') for line in f.readlines()])
#         return data
# 
# Path: ptp/tools/robots/signatures.py
# SIGNATURES = {
#     # Admin interfaces
#     '/phpmyadmin': INFO,
#     '/admin': INFO,
#     '/backend': INFO,
#     '/private': INFO,
#     '/secret': INFO,
#     '/login': INFO,
#     '/logon': INFO}


# Path: ptp/tools/robots/parser.py
from ptp.libptp.constants import UNKNOWN
from ptp.libptp.parser import LineParser
from ptp.tools.robots.signatures import SIGNATURES

"""

:synopsis: Specialized :class:`ptp.libptp.parser.AbstractParser` classes for the robots.txt files.

.. moduleauthor:: Tao Sauvage

"""



class RobotsParser(LineParser):
    """Robots specialized parser."""

    __tool__ = 'robots'
    __format__ = 'txt'

    def __init__(self, pathname, filename='*robots.txt', light=False, first=True):

        LineParser.__init__(self, pathname, filename, light=light, first=first)