当前位置: 首页>>代码示例>>Python>>正文


Python checker.Checker类代码示例

本文整理汇总了Python中checker.Checker的典型用法代码示例。如果您正苦于以下问题:Python Checker类的具体用法?Python Checker怎么用?Python Checker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Checker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

def main(argc, argv):
    if argc != 2:
        print 'Usage: nqueens <n>'
        return 1

    n = int(argv[1], 10)

    t1 = time()
    try:
        q = propositional_nqueens(n)
    except:
        print('Threw after %f seconds' % (time()-t1))
        raise

    t2 = time()

    matrix = [[0] * n for i in xrange(n)]

    for x,y in q:
        matrix[x][y] = 1

    checker = Checker(matrix=matrix)
    if checker.test_all(False) == False:
        checker.print_error_matrix()
    else:
        display_solutions(q)
        print('# calculated in %f seconds' % (t2 - t1))
        print("print '%s'" % n)
        print("print '%s'" % ' '.join(str(column + 1) for row, column in q))

    return 0
开发者ID:benjamincburns,项目名称:nqueens-solver,代码行数:31,代码来源:propositional_nqueens.py

示例2: main

def main(args):
    with codecs.open(args.props, 'r', encoding='utf-8') as f:
        meta = json.loads(f.read())

    logging.info('Creating dataset instance')
    ds = Dataset(meta['database'])

    logging.info('Creating scrapper instance')
    spr1 = SiteScrapper(meta['scrapper'], phantomjs='phantomjs1')
    spr2 = SiteScrapper(meta['scrapper'], phantomjs='phantomjs2')

    logging.info('Creating manager instance')
    mgr1 = Manager(ds, spr1, meta['conf'])
    mgr2 = Manager(ds, spr2, meta['conf'])

    threads = []
    crawler = Crawler(mgr1)
    crawler.daemon = True
    crawler.start()
    threads.append(crawler)

    checker = Checker(mgr2)
    checker.daemon = True
    checker.start()
    threads.append(checker)

    # for th in threads:
    #     th.join()
    while True:
        pass
开发者ID:montenegrodr,项目名称:drcrwler,代码行数:30,代码来源:crwler.py

示例3: main

def main():
  ch = Checker()

  while True:
    n = ch.readInt()
    if n == 0:
      break
    ch.checkRange(n, N_MIN, N_MAX, 'N')
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:8,代码来源:validator.py

示例4: MainWindow

class MainWindow(QtWidgets.QWidget):
	def __init__(self, parent=None):
		super(MainWindow, self).__init__()
		self.ui = mainWnd.Ui_MainForm()
		self.ui.setupUi(self)

		width = self.frameGeometry().width()
		height = self.frameGeometry().height()

		wid = QtWidgets.QDesktopWidget()
		screenWidth = wid.screen().width()
		screenHeight = wid.screen().height()
		self.setGeometry((screenWidth/2)-(width/2),(screenHeight/2)-(height/2),width,height)

		self.checker = Checker()
		self.checker.set_main_wnd(self)		
		
		self.ui.pbCheck.clicked.connect(self.on_check_clicked)

	def set_start_wnd(self, wnd):
		self.startWnd = wnd
		self.checker.set_start_wnd(wnd)

	def closeEvent(self, e):
		result = QtWidgets.QMessageBox.question(self, 'Закрытие', 'Вы действительно хотите завершить тест?', QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No, QtWidgets.QMessageBox.No)
		if result == QtWidgets.QMessageBox.Yes:
			self.hide()
			self.startWnd.show()
		else:
			e.ignore()

	def start_test(self):
		self.checker.gen_new_digit()
		self.checker.isFirst = False

	def on_check_clicked(self):
		digit = 0

		if self.ui.pbCheck.text() == "Ответить":
			try:
				count = int( self.ui.edCount.text() )
			except:
				QtWidgets.QMessageBox.warning(self, 'Error', 'Неверные символы в поле повторений! Необходимо число!', QtWidgets.QMessageBox.Yes)
				self.ui.edDiff.setText("0")
				return

			self.checker.add_digit( count )
			self.ui.pbCheck.setText("Далее")
			self.ui.pbCheck.setIcon(QtGui.QIcon("images/next_8028.ico"))			
			return
		else:
			if not self.checker.isError:
				self.checker.gen_new_digit()
			else:
				self.ui.lbRes.setText("")
				self.checker.isError = False
			self.ui.pbCheck.setIcon(QtGui.QIcon("images/apply_5183.ico"))
			self.ui.pbCheck.setText("Ответить")
开发者ID:LittleBuster,项目名称:CheckYourMemory,代码行数:58,代码来源:main.py

示例5: start_loop

def start_loop():
	check_robot = Checker()
	while True:
		line = raw_input("simpleChecker>")
		if line == "quit":
			break
		else:
			for response_text in check_robot.respond_to(line):
				print response_text 
开发者ID:fuluchii,项目名称:simpleChecker,代码行数:9,代码来源:simpleChecker.py

示例6: main

def main():
  ch = Checker()

  while True:
    a, b = ch.readInts(2)
    if a == 0 and b == 0:
      break
    ch.checkRange(a, MIN, MAX, 'A')
    ch.checkRange(b, MIN, MAX, 'B')
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:9,代码来源:validator.py

示例7: main

def main():
  ch = Checker()

  while True:
    coefficients = ch.readInts(4)
    if coefficients == [0, 0, 0, 0]:
      break
    for i in xrange(len(coefficients)):
      ch.checkRange(coefficients[i], MIN, MAX, chr(ord('A') + i))
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:9,代码来源:validator.py

示例8: main

def main():
    checker = Checker()
    checker.addTest(checkingScript, [add, add, ""], "abcabc", "+= 'abc', += 'abc'")
    checker.addTest(checkingScript, [add, reverse, "xyz"], "zyxabc", "+= 'abc', reverse(x)")
    checker.addTest(checkingScript, [reverse, add, "xyz"], "cbazyx", "reverse(x), += 'abc'")
    checker.addTest(checkingScript, [reverse, reverse, "xyz"], "xyz", "reverse(x), reverse(x)")
    checker.doTesting(solution.collapse)
开发者ID:Ciemny,项目名称:PSI,代码行数:7,代码来源:testuj.py

示例9: check_connectivity

def check_connectivity(G):
	checker = Checker(G)
	try:
		G, chains = chain_decomposition(G, checker)
		add_chains(G, chains, checker)
	except ConnEx as e:
	 	print type(e), e.args
	 	return False
	checker.verify()

	return True
开发者ID:adrianN,项目名称:edge-connectivity,代码行数:11,代码来源:implementation.py

示例10: test_getUrlStatus

    def test_getUrlStatus(self):
        print ">>> test_getUrlStatus"
        app     = LinkCrawler()
        checker = Checker(app)
        configIsLoaded = app.loadConfigurationSite("unittest")

        if configIsLoaded is False:
            self.fail("load configuration failed")
        else:
            statusCode = checker.getStatusCode("http://www.google.de")

        print "<<< test_getUrlStatus [statusCode: %s]\n" % statusCode
        self.failUnless(statusCode)
开发者ID:ctietze,项目名称:ip_linkcrawler,代码行数:13,代码来源:test_linkcrawler.py

示例11: main

def main():
  ch = Checker()

  while True:
    l = ch.readInt()
    if l == 0:
      break
    ch.checkRange(l, L_MIN, L_MAX, 'L')

    s = ch.readString()
    ch.checkValidCharacter(s, '+-.')
    ch.checkRange(len(s), l, l, 'length of S')
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:12,代码来源:validator.py

示例12: main

def main():
  ch = Checker()

  while True:
    n = ch.readInt()
    if n == 0:
      break
    ch.checkRange(n, MIN, N_MAX, 'N')
    
    for _ in xrange(n):
      s = ch.readString()
      ch.checkValidCharacter(s, string.ascii_uppercase)
      ch.checkLength(s, n, 'S', 'N')
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:13,代码来源:validator.py

示例13: constraintCheck

 def constraintCheck(self, queryGeom, epsg):
     
     # Prompt the user for a reference number
     refDlg = ReferenceNumberDialog()
     result = refDlg.exec_()
     if result == QDialog.Rejected:
         # User pressed cancel
         return
     
     refNumber = refDlg.getRefNumber()
     
     try:
         c = Checker(self.iface, refNumber)
         c.check(queryGeom, epsg)
         c.display()
     except:
         QMessageBox.critical(self.iface.mainWindow(), 'Query Failed', 'The query failed and the detailed error was:\n\n%s' % traceback.format_exc() )
开发者ID:cbertelli,项目名称:qgis-constraint-checker-plugin,代码行数:17,代码来源:constraintchecker.py

示例14: main

def main():
  ch = Checker()

  while True:
    n = ch.readInt()
    if n == 0:
      break
    ch.checkRange(n, MIN, N_MAX, 'N')
    
    for _ in xrange(n):
      d, l = ch.matchRegex(r'(\w) (\d)')
      l = int(l)
      ch.checkValidCharacter(d, 'LR')
      ch.checkRange(l, MIN, L_MAX, 'L')
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:14,代码来源:validator.py

示例15: main

def main():
  ch = Checker()

  while True:
    n = int(ch.readLine())
    if n == 0:
      break
    ch.checkRange(n, 3, 50, 'n')
    ps = []
    for _ in range(n):
      x, y = [int(w) for w in ch.readLine().strip().split()]
      ch.check((x, y) not in ps, "no dup points: (%d, %d)" % (x, y))
      ch.checkRange(x, -500, 500, 'x')
      ch.checkRange(y, -500, 500, 'y')
      ps.append((x, y))
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:15,代码来源:validator.py


注:本文中的checker.Checker类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。