コード例 #1
0
ファイル: downloader.py プロジェクト: havrlant/fca-search
	def download(self, urls, targetFolder):
		for url in urls:
			try:
				cont = urlopen(url).read().decode('utf-8')
				savefile(cont, targetFolder + self.getName(url))
				print('OK: ' + url)
				sleep(2)
			except Exception as err:
				print('Unable to get: ' + url)
				print('Error: ' + str(err))
コード例 #2
0
 def download(self, urls, targetFolder):
     for url in urls:
         try:
             cont = urlopen(url).read().decode('utf-8')
             savefile(cont, targetFolder + self.getName(url))
             print('OK: ' + url)
             sleep(2)
         except Exception as err:
             print('Unable to get: ' + url)
             print('Error: ' + str(err))
コード例 #3
0
ファイル: search_test.py プロジェクト: havrlant/fca-search
	def testSearchCommand(self):
		path = TEST_FOLDER 
		fun = self.runShell
		dfun = lambda dtb, q: fun(dtb, q).decode("utf-8")
		save = lambda cont, name: savefile(cont, path + name + '.txt', False)
		read = lambda name: readfile(path + name + '.txt')
		ass = self.assertEqual
		
		# search matweb
		queries = ['derivace', 'nesmysl', '(spocetne OR nespocetne) mnoziny', 'rovnice', 'rovnice NOT (linearni OR pravdepodobnost)']

		ass(dfun('matweb-test', 'derivace'), read('matweb0'))
		ass(dfun('matweb-test', 'nesmysl'), read('matweb1'))
		ass(dfun('matweb-test', '(spocetne OR nespocetne) mnoziny'), read('matweb2'))
		# ass(dfun('matweb-test', 'rovnice'), read('matweb3'))
		ass(dfun('matweb-test', 'rovnice NOT (linearni OR pravdepodobnost)'), read('matweb4'))
コード例 #4
0
ファイル: search_test.py プロジェクト: KGerring/fca_search
    def testSearchCommand(self):
        path = TEST_FOLDER
        fun = self.runShell
        dfun = lambda dtb, q: fun(dtb, q).decode("utf-8")
        save = lambda cont, name: savefile(cont, path + name + '.txt', False)
        read = lambda name: readfile(path + name + '.txt')
        ass = self.assertEqual

        # search matweb
        queries = [
            'derivace', 'nesmysl', '(spocetne OR nespocetne) mnoziny',
            'rovnice', 'rovnice NOT (linearni OR pravdepodobnost)'
        ]

        ass(dfun('matweb-test', 'derivace'), read('matweb0'))
        ass(dfun('matweb-test', 'nesmysl'), read('matweb1'))
        ass(dfun('matweb-test', '(spocetne OR nespocetne) mnoziny'),
            read('matweb2'))
        # ass(dfun('matweb-test', 'rovnice'), read('matweb3'))
        ass(dfun('matweb-test', 'rovnice NOT (linearni OR pravdepodobnost)'),
            read('matweb4'))
コード例 #5
0
ファイル: settings.py プロジェクト: KGerring/fca_search
	def save(self, path):
		savefile(self.text, path)