# Path: anchorhub/lib/filetolist.py
# class FileToList(object):
#     """
#     FileToList is a helper class used to import text files and turn them into
#     lists, with each index in the list representing a single line from the
#     text file.
#     """
#     @staticmethod
#     def to_list(file_path):
#         """
#         Static method. Takes in a file path, and outputs a list of stings.
#         Each element in the list corresponds to a line in the file.
#         :param file_path: string file path
#         :return: A list of strings, with elements in the list corresponding
#         to lines in the file pointed to in file_path
#         """
#         l = []
#         f = open(file_path, 'r')
#         for line in f:
#             l.append(line)
#         f.close()
#         return l


from abc import ABCMeta, abstractmethod
from anchorhub.lib.filetolist import FileToList
        The second dictionary maps file_paths to lists. Each entry on the
        list corresponds to a duplicate tag found in the file. The entries
        are lists with the following information: [tag, line_number,
        previous-anchor-used]

        :param file_paths:
        :return: Two dictionaries. The first maps string file paths to
            dictionaries. These inner dictionaries map AnchorHub tags to
            generated anchors. The second dictionary maps file paths to lists
            containing information about duplicate tags found on each page.
        """
        for file_path in file_paths:
            self._anchors[file_path], d = self.collect_single_file(file_path)
            if len(d) > 0:
                # There were duplicates found in the file
                self._duplicate_tags[file_path] = d
            self._reset_switches()
        return self._anchors, self._duplicate_tags

    def collect_single_file(self, file_path):
        """
        Takes in a list of strings, usually the lines in a text file,
        and collects the AnchorHub tags and auto-generated anchors for the
        file according to the  Collector's converter, strategies, and switches

        :param file_path: string file path of file to examine
        :return: A dictionary mapping AnchorHub tags to auto-generated
            anchors, and a list of containing an entry for each duplicate tag
            found on the page.
        """

# Path: anchorhub/lib/filetolist.py
# class FileToList(object):
#     """
#     FileToList is a helper class used to import text files and turn them into
#     lists, with each index in the list representing a single line from the
#     text file.
#     """
#     @staticmethod
#     def to_list(file_path):
#         """
#         Static method. Takes in a file path, and outputs a list of stings.
#         Each element in the list corresponds to a line in the file.
#         :param file_path: string file path
#         :return: A list of strings, with elements in the list corresponding
#         to lines in the file pointed to in file_path
#         """
#         l = []
#         f = open(file_path, 'r')
#         for line in f:
#             l.append(line)
#         f.close()
#         return l


# Path: anchorhub/collector.py
from abc import ABCMeta, abstractmethod
from anchorhub.lib.filetolist import FileToList

        The second dictionary maps file_paths to lists. Each entry on the
        list corresponds to a duplicate tag found in the file. The entries
        are lists with the following information: [tag, line_number,
        previous-anchor-used]

        :param file_paths:
        :return: Two dictionaries. The first maps string file paths to
            dictionaries. These inner dictionaries map AnchorHub tags to
            generated anchors. The second dictionary maps file paths to lists
            containing information about duplicate tags found on each page.
        """
        for file_path in file_paths:
            self._anchors[file_path], d = self.collect_single_file(file_path)
            if len(d) > 0:
                # There were duplicates found in the file
                self._duplicate_tags[file_path] = d
            self._reset_switches()
        return self._anchors, self._duplicate_tags

    def collect_single_file(self, file_path):
        """
        Takes in a list of strings, usually the lines in a text file,
        and collects the AnchorHub tags and auto-generated anchors for the
        file according to the  Collector's converter, strategies, and switches

        :param file_path: string file path of file to examine
        :return: A dictionary mapping AnchorHub tags to auto-generated
            anchors, and a list of containing an entry for each duplicate tag
            found on the page.
        """

        lines = FileToList.to_list(file_path)