Beispiel #1
0
 def repaint(self):
     '''
     Repaints the board
     '''
     clear()
     self.screen.render()
     self.headline()
Beispiel #2
0
def main():

    util.clear()

    while True:
        keyword = input('\n O que deseja pesquisar no Stackoverflow ? '
                        '( Crtl+c para sair ): ')

        result = asyncio.run(context.Stackoverflow().search_async(keyword))

        for item in result["items"]:

            question = 'Pergunta: {}'.format(item["title"])
            score = 'Votos: {}'.format(item["score"])
            link = 'Resposta: {}'.format(item["link"])

            research = 'Resultado de sua pesquisa no Stackoverflow para <b> {} </b> : \
                        \n\n'.format(keyword)

            research += question + '\n\n'
            research += score + '\n'
            research += link + '\n'

            # Send a message to Telegram

            bot = chatbot.Telegram()
            bot.send_message(research)

            research = ''

            # Print a research on screen

            util.result_in_screen(keyword, question, score, link)
Beispiel #3
0
 def level_screen(cls, level, lives, points):
     '''
     Printed in between levels
     '''
     clear()
     print("Level: " + str(level))
     print("Lives left: " + str(lives))
     print("Total Points: " + str(points))
     print("Press any key to continue")
Beispiel #4
0
def hreload():
    util.clear()
    reload(util)
    reload(RichTopoShape)
    reload(walls)
    reload(window)
    reload(common)
    reload(windows)
    reload(cabinet)
    reload(kitchenCabinet)
    reload(wallCabinet)
    reload(kitchenTable)
Beispiel #5
0
def run_ticker():
    while True:
        try:
            u.run(currencies)

            with open('upbit.json', 'w') as out:
                json.dump(
                    {
                        'KRW_last': u.KRW_last,
                        'BTC_last': u.BTC_last,
                        'diff': u.diff
                    }, out)

            t = PrettyTable(["Index"] + currencies)
            t = PrettyTable(["currency", "KRW", "BTC", "positive", "negative"])
            for (k, v) in u.KRW_last.items():
                r = [k, util.make_cell(k, u.KRW_last[k], 0)]
                if k in u.BTC_last:
                    r.append(util.make_cell(k, u.BTC_last[k], 12, False))
                else:
                    r.append("")
                if k in u.diff:
                    for threshold in range(102, 111):
                        if u.diff[k] > threshold:
                            slack.chat.post_message(
                                '#+%s' % threshold, '%s %s %s %s' %
                                (k, u.KRW_last[k], u.BTC_last[k], u.diff[k]))
                    for threshold in range(90, 99):
                        if u.diff[k] < threshold:
                            slack.chat.post_message(
                                '#-%s' % threshold, '%s %s %s %s' %
                                (k, u.KRW_last[k], u.BTC_last[k], u.diff[k]))
                    if u.diff[k] > 100:
                        r = r + [u.diff[k], ""]
                    else:
                        r = r + ["", u.diff[k]]
                r = r + [""] * (5 - len(r))
                t.add_row(r)

            if (len({k: v for (k, v) in u.diff.items() if v <= 97}) > 0):
                pygame.mixer.music.play()

            t.align = "l"

            util.clear()
            print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
            print(t)

        except Exception as e:
            #slack_bot.chat.post_message("#error", "failed with error code: {}".format(e))
            print("failed with error code: {}".format(e))

        time.sleep(1)
Beispiel #6
0
 def showAll(self,pnt=Base.Vector(0,0,0),dir=Base.Vector(0, 0, 1)):
     util.clear()
     parts = [];
     util.concat(parts,self.makeDrawerHolder())
     util.concat(parts,self.makeShelf1())
     doc=FreeCAD.activeDocument()
     grp=doc.addObject("App::DocumentObjectGroup", "Workbench")
     for p in parts:
         o =  doc.addObject("Part::Feature", "Part")
         o.Shape = p
         grp.addObject(o) 
     pass
Beispiel #7
0
    def preprocess(self, input, use_vad=True):
        output = input
        if use_vad:
            output = os.path.join(r'E:\temp', os.path.basename(input))
            util.Vad().get_audio_with_vad(input, output)

        y, sr = librosa.load(output, sr=16000)

        if use_vad:
            util.clear(output)  # 清除临时文件

        signal = python_speech_features.sigproc.preemphasis(y, 0.97)
        return signal, sr
Beispiel #8
0
def skirmish(player):
    util.clear()
    if not player['team']['helpers']:
        g("Hi there, you look like you are new to these skirmishes, let me get you up to speed"
          )
        g("First off, I'm the Game Master, and I'm in charge of the teams here"
          )
        g("Teams get to battle together to win gold and such")
        g("You don't seem to have a team member, so you can't battle right now, come back when you do!"
          )
        input()
    else:
        stat(player)
Beispiel #9
0
def test():
    util.clear()
    reload(util); 
    s = sBuild()
    bb = s.BoundBox
    box = util.box(max(1,bb.XLength),max(1,bb.YLength),max(1,bb.ZLength))\
            .transO(v(bb.XMin,bb.YMin, bb.ZMin))

    util.show(box)
    util.show(s)
    e = s.Edges[3]
    util.show(e)
    splits = util.splitFaceAlong(s,util.dir(e),[100,500,800]); 
    util.addGroup("splits",map(lambda f: util.trimFace(f,10),splits))
Beispiel #10
0
def speak_dude(player):
	util.clear()
	good_talk = ['Hi there, how are you?', "Hello, nice day isn't it?", "Hi there!"]
	bad_talk = ['Ohno, are you here to kill me?', "Please, go away", 'Help its the bad man!']
	good_talk2 = ["I'm off to go fishing see you later", "Goodbye now", "See you around"]
	bad_talk2 = ["Please don't kill me!", "Go away!", "AAHHHH!"]
	if player['bad_points'] > player['good_points']:
		old_man(random.choice(bad_talk))
		input()
		old_man(random.choice(bad_talk2))
		print("[1] Kill the villager")
		print("[2] Leave the villager")
		print("[3] Rob the villager")
		choice = input()
		if choice == '1':
			s_print("You killed a villager!")
			player['bad_points'] += 3
		elif choice == '2':
			s_print("You walked away from the villager")
		elif choice == '3':
			cash = random.randint(1,20)
			s_print("You robbed the villager and got " + str(cash) + ' gold')
			player['bad_points'] += 1
			player['gold'] += cash
		else:
			s_print("You walked away...")
	else:
		old_man(random.choice(good_talk))
		input()
		old_man(random.choice(good_talk2))
		print("[1] Give the villager some money")
		print("[2] Leave the villager")
		print("[3] Rob the villager")
		i = input()
		if i == '1':
			cash = random.randint(1,10)
			s_print("You gave the villager " + str(cash) + 
			' gold')
			player['gold'] -= cash
			player['mission13'] = True
		elif i == '3':
			cash = random.randint(1,20)
			s_print("You robbed the villager and got " + str(cash) + ' gold')
			player['gold'] += cash
			player['mission13'] = True
		else:
			s_print("You walked away...")
	input()
	util.clear()
Beispiel #11
0
def king(player):
	util.clear()
	if player['bad_points'] > 5:
		k("Why have you come here? I know your evil deeds!")
		t = choice('Kill him', "Tell him you are sorry for the bad things you did")
		if t == '1':
			s_print("You draw your " + player['main_weapon'])
			k("So it is treason then?")
			battle.king_fight()
		else:
			k("If you truly wish to be pardoned, you can, but you will have to pay for your crimes!")
			k("Guards, lock him in the dungeon until he has paid for his crimes!")
			util.sentence(player['bad_points'] * 3)
	
	elif player['mission1'] == False and util.count_list(player['monster_parts'], 'Kraveb Head') >= 3:
		player['mission1'] = True
		player['weapons'].append("Ice Pick")
		k("You have completed your quest! Very good, here is an Ice Pick!")
		k("It is a deadly weapon at close range against enemies, weild it with skill and you will be very strong in battle")
		player['gold'] += 25
		k("Also, here is 25 gold coins for finishing the task so fast")
		k("And now I have another mission for you!")
		time.sleep(1)
		util.clear()
		k("A fiend roams my lands, his name is Maximus the III")
		k("He claims he is the heir to this throne, although he is not, and attemps to stir the commonfolk up")
		k("I would allow you to hunt him but you have not proven yourself yet")
		k("Find and kill a Thorg, and you will be strong enough to battle him!")
	elif player['mission1'] != True:
		k("You, warrior! You seem to be strong, I have a quest for you!")
		k("Monsters plague my lands, and if you bring me the head of three kraveb, I will grant you a special weapon!")
	elif player['mission1'] == True and player['mission2'] != True and 'Thorg' in player['kills']:
		k("You are a strong warrior, for you have defeated a thorg!")
		k("Now I know you are strong enough to battle Maximus himself!")
		k("For now he is banished to the realm of monsters, here is a key to that land, but beware, it is a very dangerous place to be!")
		player['unlocked_locations'].append("Monster Lands")
		s_print("You have unlocked a new location: Monster Lands")
		player['mission2'] = True
		database.save(player)
	elif player['mission3'] == False:
		k("Go to the monsterlands, and defeat Maximus the III")
	elif player['mission3'] == True:
		k("You have defeated Maximus the III? You are more powerful then I first thought")
		k("You are very powerful, powerful enough to travel to dangerous lands")
		s_print("You unlocked a new location: Far Place")
		player['unlocked_locations'].append('Far Place')
		database.save(player)
	input()
Beispiel #12
0
def print_table(EX, C, SU, TU, nu, RP, SA):
    t = PrettyTable(make_header(C))
    for kv in EX.items():
        for row in make_exchange_body(name=kv[0],
                                      ex=kv[1],
                                      C=C,
                                      SU=SU,
                                      nu=nu,
                                      TU=TU):
            t.add_row(row)
    for row in make_NRPR_body(EX=EX, RP=RP, C=C, TU=TU, nu=nu, SA=SA):
        t.add_row(row)
    t.align = "l"
    util.clear()
    print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
    print(t)
Beispiel #13
0
def showAll(pnt=Base.Vector(0, 0, 0), dir=Base.Vector(0, 0, 1)):
    util.clear()
    parts = [partFromVectors([O, x(1000), xy(1000, 1000), y(1000)], O - z(thickness))]

    util.concat(parts, util.translate(chair(), x(0)))
    # util.concat(parts,util.translate(chair('sym'), x(1500)))
    # util.concat(parts,util.translate(chair('tri'), x(3000)))

    doc = FreeCAD.activeDocument()
    grp = doc.addObject("App::DocumentObjectGroup", "Workbench")
    print(parts)
    for p in parts:
        o = doc.addObject("Part::Feature", "Part")
        if(hasattr(p, 'delegate')):
            o.Shape = p.delegate
        else:
            o.Shape = p
        grp.addObject(o)
    pass
Beispiel #14
0
def farlands(player):
	if player['bad_points'] > player['good_points']:
		z("You are not welcome here!")
		z("You deeds are evil, get out of my sight or I will kill you!")
		print("[1] Leave | [2] Stay")
		i = input()
		if i == '1':
			z("And stay away!")
		else:
			z("You dare challenge me!")
			print(Fore.RED + "Z inflicts 1000 Damage on you and blasts you from his site")
			player['life'] -= 1000
			player['location'] = 'Monster Lands'
			database.save(player)
	elif player['mission5'] != True:
		z("You are not welcome here!")
		z("Get out of my sight or I will kill you!")
		print("[1] Leave | [2] Stay")
		i = input()
		if i == '1':
			z("And don't come back!")
		else:
			z("I told you to leave!")
			you(player, 'Wait, I come in peace')
			z("Peace has not been in this place since the swarms attacked")
			you(player, 'Swarms?')
			z("Duck swarms... usually they aren't dangerous, but in a large swarm, these ducks will devour you in seconds")
			you(player, 'If I drive them off would I be welcome here?')
			z("Ha! You, defeate them? Good luck!")
			z("If killing the ducks was all that was needed to be done, I would of done it myself years agod\nNo, you must defeat the Grim Quacker to destroy the swarms")
			you(player, "I thought Grim Quackers were just a thing of legend?")
			z("They are real, and here, defeat it, and I will allow you come here in peace")
			you(player, "I will kill this Grim Quacker...")
	elif player['mission5'] == True and player['mission6'] != True:
		z('So you have survived it swarms? That was the easy part, go and defeat the Grim Quacker')
	elif player['mission6'] == True:
		z("You are welcome in my lands...")
	input()
	util.clear()
Beispiel #15
0
def hreload():
    util.clear()
    reload(partspattern)
    reload(side)
    reload(middlepart)
Beispiel #16
0
 def debug_bar(self):
     util.clear()
     util.echo("BAR:", self.bar)
Beispiel #17
0
 def post(self, user_id):
     u_id = int(user_id)
     self.write(util.clear(u_id))
Beispiel #18
0
def wallcabinet():
    reload(wallCabinet)
    reload(util)
    util.clear()
    wallCabinet.showAll()
Beispiel #19
0
def upCabinet():
    util.clear()
    reload(kitchenCabinet)
    reload(util)
    util.addGroup("upcabinet", kitchenCabinet.upCabinet())
Beispiel #20
0
def island():
    util.clear()
    reload(kitchenCabinet)
    reload(util)
    util.addGroup("island", kitchenCabinet.island())