Esempio n. 1
0
 def parse_selected_links(self, selected_links_file_name):
     logger.info("Parsing selected links file %s." % selected_links_file_name)
     selected_links_file = open(selected_links_file_name, "rb")
     num_links = convutils.count_lines(selected_links_file)
     # Reset the file to the beginning to parse it.
     selected_links_file.seek(0)
     links = parsers.parse_selected_links_file(selected_links_file)
     return links, num_links
Esempio n. 2
0
 def _process_input_files(self):
     super(McmcCli, self)._process_input_files()
     if self.opts.seed_terms:
         logger.info("Parsing seed terms from {0}.".format(self.opts.seed_terms))
         seed_terms_file = open(self.opts.seed_terms)
         self.seed_terms = [line.strip() for line in seed_terms_file]
     else:
         self.seed_terms = None
     if self.opts.seed_links:
         logger.info("Parsing seed links from {0}.".format(self.opts.seed_links))
         seed_links_file = open(self.opts.seed_links, "rb")
         seed_links = [tuple(sorted(link)) for link in parsers.parse_selected_links_file(seed_links_file)]
         self.seed_links = seed_links
     else:
         self.seed_links = None