예제 #1
0
class TestSourceloader(unittest.TestCase):
    def setUp(self):
        self.loader = SourceLoader()

    def test_init(self):
        # Test if sourceloader points to the right directory, where the sources are present.
        self.assertIn("Source: Source", str(self.loader))
        self.assertIn("Source: NIST", str(self.loader))
        self.assertIn("Source: ChemSpider", str(self.loader))
        self.assertIn("Source: WikipediaParser", str(self.loader))

    def test_include(self):
        # Tests for the include functionality.
        self.loader.include(["So.rc.*"])

        self.assertIn("Source: Source", str(self.loader))
        self.assertNotIn("Source: NIST", str(self.loader))
        self.assertNotIn("Source: ChemSpider", str(self.loader))
        self.assertNotIn("Source: WikipediaParser", str(self.loader))

    def test_exclude(self):
        # Tests for the exclude functionality.
        self.loader.exclude(["So.rc.*"])

        self.assertNotIn("Source: Source", str(self.loader))
        self.assertIn("Source: NIST", str(self.loader))
        self.assertIn("Source: ChemSpider", str(self.loader))
        self.assertIn("Source: WikipediaParser", str(self.loader))
예제 #2
0
파일: fourmi.py 프로젝트: jjdekker/Fourmi
    setup_crawler(
        docopt_arguments["<compound>"], conf.scrapy_settings, source_loader, docopt_arguments["--attributes"].split(",")
    )
    if conf.scrapy_settings.getbool("LOG_ENABLED"):
        log.start(
            conf.scrapy_settings.get("LOG_FILE"),
            conf.scrapy_settings.get("LOG_LEVEL"),
            conf.scrapy_settings.get("LOG_STDOUT"),
        )
    reactor.run()


# The start for the Fourmi Command Line interface.
if __name__ == "__main__":
    arguments = docopt.docopt(__doc__, version="Fourmi - V0.6.0")
    loader = SourceLoader()

    if arguments["--include"]:
        loader.include(arguments["--include"].split(","))
    elif arguments["--exclude"]:
        loader.exclude(arguments["--exclude"].split(","))

    if arguments["search"]:
        search(arguments, loader)
    elif arguments["list"]:
        print "-== Available Sources ==-"
        print str(loader)
    else:
        gui_window = gui.GUI(search, sourceloader=SourceLoader())
        gui_window.run()
예제 #3
0
파일: fourmi.py 프로젝트: nhasty8100/Fourmi
    conf.set_logging(docopt_arguments["--log"], docopt_arguments["-v"])
    conf.set_output(docopt_arguments["--output"], docopt_arguments["--format"],
                    docopt_arguments["<compound>"])
    setup_crawler(docopt_arguments["<compound>"], conf.scrapy_settings,
                  source_loader, docopt_arguments["--attributes"].split(','))
    if conf.scrapy_settings.getbool("LOG_ENABLED"):
        log.start(conf.scrapy_settings.get("LOG_FILE"),
                  conf.scrapy_settings.get("LOG_LEVEL"),
                  conf.scrapy_settings.get("LOG_STDOUT"))
    reactor.run()


# The start for the Fourmi Command Line interface.
if __name__ == '__main__':
    arguments = docopt.docopt(__doc__, version='Fourmi - V0.6.0')
    loader = SourceLoader()

    if arguments["--include"]:
        loader.include(arguments["--include"].split(','))
    elif arguments["--exclude"]:
        loader.exclude(arguments["--exclude"].split(','))

    if arguments["search"]:
        search(arguments, loader)
    elif arguments["list"]:
        print "-== Available Sources ==-"
        print str(loader)
    else:
        gui_window = gui.GUI(search, sourceloader=SourceLoader())
        gui_window.run()