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)
        file_anchors = {}
        file_duplicates = []
        for i in range(len(lines)):
            # Flip any switches that are triggered by this line
            self._try_switches(lines, i)
            if self._no_switches_on():
                for s in self._strategies:
                    if s.test(lines, i):
                        # This strategy found an anchor and knows how to parse
                        tag, convert_me = s.get(lines, i)
                        if tag in file_anchors:
                            # Duplicate tag
                            file_duplicates.append((tag, i + 1,
                                                    file_anchors[tag]))
                        else:
                            anchor = self._converter(convert_me, file_anchors)
                            file_anchors[tag] = anchor
            self._arm_switches()
        return file_anchors, file_duplicates
def collect_single_file ( self , file_path ) : lines = FileToList . to_list ( file_path ) file_anchors = { } file_duplicates = [ ] for i in range ( len ( lines ) ) : self . _try_switches ( lines , i ) if self . _no_switches_on ( ) : for s in self . _strategies : if s . test ( lines , i ) : tag , convert_me = s . get ( lines , i ) if tag in file_anchors : file_duplicates . append ( ( tag , i + 1 , file_anchors [ tag ] ) ) else : anchor = self . _converter ( convert_me , file_anchors ) file_anchors [ tag ] = anchor self . _arm_switches ( ) return file_anchors , file_duplicates
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.