Ejemplo n.º 1
0
def GetNumOfSys():
    global r
    global num_dict
    #try:
    dict1 = json.loads(RestApiLogin.r.get(url=dataconfig.interface_url).text)
    num_dict = len(dict1)
    #except:
    #	num_dict=0
    cp = configparser.ConfigParser()
    cp.read('./data/WorldTime.cfg')
    id1 = cp.get('Port', 'Port_num')
    id1 = int(id1)
    if id1 != num_dict:
        cp.set('Port', 'Port_num', str(num_dict))
        cp.write(open('./data/WorldTime.cfg', 'w'))
        Reset.reset_policy()
    return num_dict
Ejemplo n.º 2
0
 def get(self):
     self.set_header("Content-Type", "application/json")
     res = Reset.reset_policy()
     if res == True:
         static_interface.Stat.GetStat('All')
         self.write(json.dumps('ok'))
         self.set_status(200, '')
         Web_log.info('Reset OK by %s' % self.username)
     else:
         self.write(json.dumps({"status_code": 400, "res": "reset failed"}))
         Web_log.info('Reset Failed by %s' % self.username)
         self.set_status(400, '')
Ejemplo n.º 3
0
	def get(self):
		ip_address=self.request.remote_ip
		self.set_header("Content-Type","application/json")
		res=Reset.reset_policy()
		if res==True:
			yield Logconfig.Write_Sys_Log(self,self.username,'系统配置','复位配置',ip_address,' ',200)
			self.write(json.dumps('ok'))
			self.set_status(200,'')
			Web_log.info('reset OK by %s'%self.username)
		else:
			self.write(json.dumps({"status_code":400,"res":"reset failed"}))
			Web_log.info('Reset Failed by %s'%self.username)
			self.set_status(400,'')
Ejemplo n.º 4
0
def depth_first_search(window, buttons, colors, graph, nodes, edges):

    graph.dfs(0)

    while True:
        window.fill(colors['paper'])
        pygame.draw.line(window, colors['emerald'], (20, 70), (780, 70))
        Handle_Button.draw_btns(buttons, colors['emerald'])
        pos = pygame.mouse.get_pos()

        for event in pe.get():

            if event.type == pl.QUIT:
                pygame.quit()
                sys.exit()

            if event.type == pl.KEYDOWN:
                if event.key == pl.K_ESCAPE:
                    pygame.quit()
                    sys.exit()

            if event.type == pl.MOUSEBUTTONDOWN:
                if buttons[3].isOver(pos):
                    Reset.reset(window, buttons, colors, graph, nodes, edges)

            if event.type == pl.MOUSEMOTION:
                for button in buttons:
                    if button.isOver(pos):
                        button.color = colors['silver']
                    else:
                        button.color = colors['blacksteel']

        graph.nodes = nodes
        graph.edges = edges

        # showing the depth first search
        graph.dfs_show()

        pygame.display.update()
Ejemplo n.º 5
0
	
	##initiate hit or stay sequance
	answer = True
	while answer == True:
		answer = input('Would you like to Hit or Stay? ').lower()
		if answer == 'hit':                    ##player hits
			Draw.draw(1,playerhand,Deck.deck)
			playerhandtotal = Deck.total(playerhand)
			print(f'your hand: {playerhand}')
			print(f'your total: {playerhandtotal}')
			answer = True

			if playerhandtotal > 21:
					print(f'You busted with: {playerhandtotal} and lost {bet}')
					Deck.deck = (Reset.reset(playerhand,Deck.deck))
					Deck.deck = (Reset.reset(cpuhand,Deck.deck))

					answer = False


		elif answer == 'stay': ##player stays and ends the while loop
			answer = False
			compare = True

		elif answer != 'stay' or answer != 'hit': ##continues while loop if not answered correctly
			print('Invalid response.')
			answer = True  


##AI FUNCTION
Ejemplo n.º 6
0
import sys
sys.path.insert(0, r"C:\Users\user\github\FootballAnalysis\Database")

import Reset
import showTBLxlsx
import Manager

Website = "https://www.transfermarkt.co.uk/john-yems/profil/trainer/76935"

Reset.main()

Manager.main(Website, "manager")

showTBLxlsx.main()
Ejemplo n.º 7
0
v.billet = pygame.image.load("data/billet.png").convert()
v.CoinIm = pygame.image.load("data/coin.png")
v.onglet_unlock = pygame.image.load("data/onglet_unlock.png")
v.onglet_lock   = pygame.image.load("data/onglet_lock.png")
v.bgshop = pygame.image.load("data/shop_bg.png").convert()
v.bgusers_unlock = pygame.image.load("data/bg_users_unlock.png").convert()
v.bgusers_lock   = pygame.image.load("data/bg_users_lock.png").convert()
v.option_bg = pygame.image.load("data/option_bg.png").convert()
v.popUp = pygame.image.load("data/popUp.png").convert()
v.bg = pygame.image.load("data/bg.png").convert()
v.ecoplus = pygame.image.load("data/ecoplus.png").convert()

while v.MainGameMaster: # boucle principale du jeu
	pygame.display.flip() # Actualisation de la page

	AutoClick(timer.tick())
	if v.toshow == 'Loading': Loading()
	if v.toshow == 'PopUp': PopUp()
	if v.toshow == 'Game': Game() # affichages des différents pages
	if v.toshow == 'Option': Option()
	if v.toshow == 'Stats': Stats()
	if v.toshow == 'Credits': Credits()
	if v.toshow == 'Shop': Shop()
	if v.toshow == 'Reset': Reset()

	for event in pygame.event.get():
		if event.type == pygame.QUIT: v.MainGameMaster = False
		if event.type == pygame.KEYDOWN: keyPressed(event.key, event.unicode) # On verifie si une touche a été appuyée
		if event.type == pygame.MOUSEBUTTONDOWN: mousePressed(pygame.mouse.get_pos()) # On vérifie un clic souris
		if event.type == pygame.KEYUP: v.keyCode = 0
pygame.quit()