A web scraper build to search specific information for a given compound (and its pseudonyms)

Fixed merge conflict

+39 -37
+30
GUI/configImporter.py
··· 1 + import ConfigParser 2 + 3 + 4 + class ConfigImporter(): 5 + def __init__(self, filename): 6 + """Read the filename into the parser.""" 7 + self.filename = filename 8 + self.parser = ConfigParser.ConfigParser() 9 + self.parser.read(self.filename) 10 + 11 + def load_common_attributes(self): 12 + """Loads common attributes from the initialized file.""" 13 + try: 14 + return self.parser.get('GUI_Options', 'CommonParameters') 15 + except: 16 + return 'One, Two, Three' 17 + 18 + def load_output_types(self): 19 + """Loads output types from the initialized file.""" 20 + try: 21 + return self.parser.get('GUI_Options', 'OutputTypes') 22 + except: 23 + return 'csv' 24 + 25 + def load_always_attributes(self): 26 + """Loads attributes that are always searched for from the initialized file.""" 27 + try: 28 + return self.parser.get('GUI_Options', 'AlwaysParameters') 29 + except: 30 + return 'Name, Weight'
+3 -30
GUI/gui.py
··· 1 1 from Tkinter import * 2 2 import os 3 3 4 - class ConfigImporter(): 5 - def __init__(self, filename): 6 - """Read the filename into the parser.""" 7 - import ConfigParser 8 - self.filename = filename 9 - self.parser = ConfigParser.ConfigParser() 10 - self.parser.read(self.filename) 11 - 4 + from configImporter import * 12 5 13 - def load_common_attributes(self): 14 - """Loads common attributes from the initialized file.""" 15 - try: 16 - return self.parser.get('GUI_Options', 'CommonParameters') 17 - except: 18 - return 'One, Two, Three' 19 - 20 - def load_output_types(self): 21 - """Loads output types from the initialized file.""" 22 - try: 23 - return self.parser.get('GUI_Options', 'OutputTypes') 24 - except: 25 - return 'csv' 26 - 27 - def load_always_attributes(self): 28 - """Loads attributes that are always searched for from the initialized file.""" 29 - try: 30 - return self.parser.get('GUI_Options', 'AlwaysParameters') 31 - except: 32 - return 'Name, Weight' 33 6 34 7 class GUI(): 35 - def __init__(self, search, config_file='GUI/gui.cfg', sourceloader = None, in_source=True): 8 + def __init__(self, search, config_file='GUI/gui.cfg', sourceloader=None, in_source=True): 36 9 """Boots the window, configuration.""" 37 10 if in_source: 38 11 current_dir = os.path.dirname(os.path.abspath(__file__)) ··· 168 141 print "No known class, {}, {}".format(name, var) 169 142 170 143 self.values = values 171 - if all([values.get(i)!='' for i in self.required_variables]): 144 + if all([values.get(i) != '' for i in self.required_variables]): 172 145 self.finish_with_search = True 173 146 self.window.destroy() 174 147 else:
+6
fourmi.py
··· 3 3 Fourmi, a web scraper build to search specific information for a given compound (and it's pseudonyms). 4 4 5 5 Usage: 6 + fourmi 6 7 fourmi search <compound> 7 8 fourmi [options] search <compound> 8 9 fourmi [options] [-v | -vv | -vvv] [--include=<sourcename> | --exclude=<sourcename>] search <compound> ··· 24 25 """ 25 26 26 27 from twisted.internet import reactor 28 + 27 29 from scrapy.crawler import Crawler 28 30 from scrapy import signals, log 29 31 import docopt ··· 31 33 from FourmiCrawler.spider import FourmiSpider 32 34 from utils.configurator import Configurator 33 35 from utils.sourceloader import SourceLoader 36 + from GUI import gui 34 37 35 38 36 39 def setup_crawler(compound, settings, source_loader, attributes): ··· 82 85 elif arguments["list"]: 83 86 print "-== Available Sources ==-" 84 87 print str(loader) 88 + else: 89 + gui_window = gui.GUI(search, sourceloader=SourceLoader()) 90 + gui_window.run()
-7
gui_launcher.py
··· 1 - from fourmi import search 2 - from GUI import gui 3 - from utils.sourceloader import SourceLoader 4 - 5 - 6 - gui_window = gui.GUI(search, sourceloader=SourceLoader()) 7 - gui_window.run()