Exemplo n.º 1
0
def main():
    print(art.text2art("Authorship"))
    print(art.text2art("Attribution"))
    # time.sleep(1)
    config = parse_config()
    runner = Runner(config)
    runner.run()
Exemplo n.º 2
0
    def judgeViolation(self):
        """judge tlr violation
        ~return~
        result of judge
        """

        # for totalize results [black, red, green, yellow]
        tlr_results_total = [0] * 4

        # totalize results
        for i in range(0, min(10, len(self.tlr_results))):
            tlr_results_total[self.tlr_results.pop()] += 1

        logging.debug(tlr_results_total)

        # if crossed while red
        if tlr_results_total.index(max(tlr_results_total)) in [2, 3]:
            text = art.text2art('out')
            print(text)
            self.pub_result.publish(True)

        # if crossed while green and yellow
        elif tlr_results_total.index(max(tlr_results_total)) == 1:
            text = art.text2art('safe')
            print(text)

        # if no tlr
        else:
            text = art.text2art('where is tlr')
            print(text)
Exemplo n.º 3
0
 def print_result(self):
     if is_game_over(self.board)[1] is None:
         Art = text2art("draw", "random")
         print(Art)
     else:
         Art = text2art(f'{self.winner} wins', "random")
         print(Art)
Exemplo n.º 4
0
def main():
    cnt = 0
    parameters = []
    # print(sys.argv[1])

    if len(sys.argv) < 3:

        ##        if(sys.argv[1] == Command_List[0]):
        ##            configure()
        ##            ctype = sys.argv[1]
        ##        elif(sys.argv[1] == Command_List[1]):
        ##            ListAvailableProductTypes()
        ##        else:
        if (len(sys.argv) == 1):
            Art = art.text2art("KT", font="black")
            print(Art)
            Art = art.text2art("UCLOUD", font="black")
            print(Art)
            print(" ")
            print(
                "usage: ucloud [type] [command] [parameters] \nor type 'ucloud help'"
            )

        elif (len(sys.argv) == 2):
            if (sys.argv[1] == "help"):
                ctype_process("help", "", parameters)
            else:
                print(
                    "usage: ucloud [type] [command] [parameters] \nor type 'ucloud help'"
                )
                exit(-1)
        else:
            print(
                "usage: ucloud [type] [command] [parameters] \nor type 'ucloud help'"
            )
            exit(-1)
    else:
        ctype = sys.argv[1]
        command = ""
        if (ctype != "help"):
            command = sys.argv[2]
        for c in Ctype_List:
            if (c == sys.argv[1]):
                ctype = c
                cnt += 1
                break
        if (cnt == 0):
            print("unable to process type: ", ctype,
                  "\n type 'ucloud help' to view supported type")
            exit(-1)
        for i in range(3, len(sys.argv)):
            parameters.append(sys.argv[i])

        ctype_process(ctype, command, parameters)
def show_art():
    mt_zeitmore = "ATOP MOUNT ZEITMORE"
    banner = "#" * 20
    print(colorful.bold_coral(mt_zeitmore))
    print(colorful.coral(banner))
    print(" " * 20)
    mt_zeit_art00=art.text2art("Atop")
    mt_zeit_art01=art.text2art("Mount")
    mt_zeit_art02=art.text2art("Zeitmore")
    print(colorful.coral(mt_zeit_art00))
    print(colorful.coral(mt_zeit_art01))
    print(colorful.coral(mt_zeit_art02)) 
Exemplo n.º 6
0
def crawl(owner, repo_name):
    print(text2art('CRAWL 4 TB') + '\n\n')
    print(art('random'))
    print(text2art(owner + '/' + repo_name))

    c = GithubCrawl()
    g = c.login(0)
    print(art('random'))
    print('Log in succeeded\n')
    repo = g.get_user(owner).get_repo(repo_name)
    issues, n = get_issues(repo)
    save_file_name = '%s.%s.json' % (owner, repo_name)
    if DEBUG:
        save_file_name = 'DEBUG.' + save_file_name
    already_saved_nums = get_file_lines(save_file_name)
    count_q = [None for _ in range(already_saved_nums)]
    time_recorder = TimeRecorder()
    thread_num = 10
    lock = Lock()
    print(art('random'))
    print('Start Crawling! Data will be saved to %s\n' % (save_file_name, ))

    @repeat_3times_if_failed
    def work(_issue):
        nonlocal count_q, lock, time_recorder
        start = time()
        missue = get_missue(g, _issue, repo)
        with lock:
            with open(save_file_name, 'a', encoding='utf-8') as f:
                s = json.dumps(missue, default=default_json_decode)
                f.write(s)
                f.write('\n')
            count_q.append(None)
            used_time = time() - start
            time_recorder.update(used_time)
            avg, left_time = time_recorder.left_time(n - len(count_q),
                                                     thread_num)
            print(f'{len(count_q)}/{n} '
                  f'[c:{len(missue.related_commits)},'
                  f'p:{len(missue.related_pulls)},'
                  f'n:{missue.issue.number}] '
                  f'used: {used_time * 1.0:.4},'
                  f'total: {time_recorder.used_time() * 1.0:.6},'
                  f'avg_speed: {avg * 1.0:.4},'
                  f'left: {left_time * 1.0:.5}')

    if not DEBUG:
        issues = issues[already_saved_nums:]
        with ThreadPoolExecutor(max_workers=thread_num) as worker:
            for _ in worker.map(work, issues):
                pass
    else:
        list(map(work, issues))
Exemplo n.º 7
0
    def get_payout_display(bet_right, cur_bet, bet_results):
        headers = ['Title', 'Stat', 'Reward']
        rows = [value.values() for value in bet_results]
        msg = format_helper.create_display_table(headers, rows, 20)
        if bet_right:
            win_text = text2art("Winner", font="random") + '\n\n'
            msg = win_text + msg
        else:
            lose_text = text2art("Loser", font="random") + '\n\n'
            msg = lose_text + msg

        header = ">>> <@!%s> bet on <@!%s> for %s" % (cur_bet.user_id, cur_bet.bet_target, cur_bet.amount)
        return header + "```" + msg + "```"
Exemplo n.º 8
0
def main(stdscr):
    current_row = 0
    game = True
    character = ">o)\n(_>"

    while game:
        resize_h, resize_w = stdscr.getmaxyx()
        check_for_resize()
        stdscr.clear()

        top = text2art("Bird jump", "small")
        bottom = text2art("extreme", "small")

        print_multiple_lines(10, (resize_w // 2) - 20, top)
        print_multiple_lines(15, (resize_w // 2) - 15, bottom)
        stdscr.refresh()

        print_menu(current_row)
        key = stdscr.getch()
        if key == curses.KEY_UP and current_row > 0:
            current_row -= 1
            print_menu(current_row)
        elif key == curses.KEY_DOWN and current_row < 3:
            current_row += 1
            print_menu(current_row)

        #EXIT Button
        if key == 10 and current_row == 3:
            press_exit()
            game = False

        #character choice
        if key == 10 and current_row == 1:
            character = choose_character(resize_w, resize_h)

        #PLAY Button
        elif key == 10 and current_row == 0:
            stdscr.clear()
            name = name_screen(resize_w, resize_h)
            while True:
                score = play(resize_w, resize_h, character, name)
                game = endscreen(score, resize_w, resize_h)
                if game == "r":
                    continue
                else:
                    break

        #Scoreboard Button
        elif key == 10 and current_row == 2:
            scoreboard = pickle.load(open("score_board.pickle", "rb"))
            game = scoreboard_screen(scoreboard, resize_w, resize_h)
Exemplo n.º 9
0
def main():
        parser=ArgumentParser()
        parser.add_argument("-C","--configure",action="store_true",help="Configure api_key and pwd")
        parser.add_argument("-S","--silent",action="store_true",help="Dont show banner")
        parser.add_argument("-P","--poll",action="store_true",help="start poll for registering/removing users")
        parser.add_argument("-M","--message",help="Message to send")
        args=parser.parse_args()


        if not args.silent:
                cprint(text2art("Notifier"),"red",file=sys.stderr)
        if not len(sys.argv)>1:
                parser.print_help()
        if args.poll:
                import NotiPy.poll
        if args.configure:
                import NotiPy.configure
        if args.message:
                db_obj=DB()
                try:
                        bot=Bot(token=db_obj.get_api_key())
                        chat_ids=db_obj.get_chat_ids()
                        for chat_id in chat_ids:
                                if args.message:
                                        bot.send_message(chat_id=chat_id,text=args.message)
                except telegram.error.InvalidToken as e:
                        cprint("[!] Invalid API token","red")
                except telegram.error.Unauthorized as e:
                        cprint("[!] Token Unauthorized.Try after requesting New Token","red")
                except:
                        cprint("[!] Some error occured","red")
Exemplo n.º 10
0
def intro(played):
    clear()
    starter(played)
    aprint("Welcome to...")
    print(text2art("Boyer's\nadventure\ngame"))
    input("\nPress enter to begin\n")
    clear()
Exemplo n.º 11
0
def ascii_art_api():
  '''
    Render a string using ASCII art
    ---
    tags:
      - ASCII
    parameters:
      - in: query
        name: string
        required: true
        schema:
          type: string
          example: Shelley
        description: the string you would like rendered using ASCII art
      - in: query
        name: font
        required: true
        schema:
          type: string
          enum: ['1943', '3d_diagonal', 'epic', 'graffiti', 'isometric1', 'sub-zero', 'nscript', 'nancyj', 'black_square', 'upside_down']
          example: 3d
        description: the [font](https://github.com/sepandhaghighi/art/blob/master/FontList.ipynb) used to render the ASCII text in
    responses:
      200:
        description: The converted value
        content:
          text/plain:
            schema:
              type: string
              example: 3140 metres
  '''
  value = request.args.get('string', '')
  font = request.args.get('font')
  art = text2art(value, font=font).replace('\r\n', '\n')
  return plain_textify(art)
Exemplo n.º 12
0
def init_logging(context):
    session_files = context["session_files"]
    
    # Setup logging
    log_filename = session_files.session_dir / "singt.log"
    logfile = open(log_filename, 'w')
    logtargets = []

    # Set up the log observer for stdout.
    logtargets.append(
        FilteringLogObserver(
            textFileLogObserver(sys.stdout),
            predicates=[LogLevelFilterPredicate(LogLevel.debug)] # was: warn
        )
    )

    # Set up the log observer for our log file. "debug" is the highest possible level.
    logtargets.append(
        FilteringLogObserver(
            textFileLogObserver(logfile),
            predicates=[LogLevelFilterPredicate(LogLevel.debug)]
        )
    )

    # Direct the Twisted Logger to log to both of our observers.
    globalLogBeginner.beginLoggingTo(logtargets)

    # ASCII-art title
    title = art.text2art("Singt Client")
    log.info("\n"+title)
Exemplo n.º 13
0
def Output_Init(InputDict, Title, Name):
    """
    Initialize output file.

    :param InputDict: input test vector
    :type InputDict:dict
    :param Title : simulation title
    :type Title :str
    :return: file object
    """
    spliter = "\n"
    if 'win' not in sys.platform:
        spliter = "\r\n"
    Art = text2art("Opem")
    if Title not in os.listdir(os.getcwd()):
        os.mkdir(Title)
    opem_file = open(os.path.join(Title, Name + ".opem"), "w")
    opem_file.write(Art)
    opem_file.write("Simulation Date : " + str(datetime.datetime.now()) +
                    spliter)
    opem_file.write("**********" + spliter)
    opem_file.write(Title + " Model" + spliter * 2)
    opem_file.write("**********" + spliter)
    opem_file.write("Simulation Inputs : " + spliter * 2)
    Input_Keys = sorted(InputDict.keys())
    for key in Input_Keys:
        opem_file.write(key + " : " + str(InputDict[key]) + spliter)
    opem_file.write("**********" + spliter)
    return opem_file
Exemplo n.º 14
0
def generator(*, text: str) -> dict:
    """
    Makes ascii art
    :param text: Text to be converted to ascii art
    :return: Dictionary
    """
    return {"output": text2art(text)}
Exemplo n.º 15
0
Arquivo: views.py Projeto: ohdnf/TIL
def pong(request):
    art_text = art.text2art(request.GET.get('inputText'))
    data = {
        'success': True,
        'content': art_text,
    }
    return JsonResponse(data)
Exemplo n.º 16
0
 async def asciify(self, ctx, *, text: str):
     """ Turns any text given into ascii """
     Art = text2art(text)
     asciiart = f"```\n{Art}\n```"
     if len(asciiart) > 2000:
         return await ctx.send("That art is too big")
     await ctx.send(asciiart)
Exemplo n.º 17
0
def Output_Init(InputDict, Title, Name):
    """
    This function initialize output file
    :param InputDict: Input Test Vector
    :type InputDict:dict
    :param Title : Simulation Title
    :type Title :str
    :return: file object
    """
    Art = text2art("Opem")
    if Title not in os.listdir(os.getcwd()):
        os.mkdir(Title)
    file = open(os.path.join(Title, Name + ".opem"), "w")
    file.write(Art)
    file.write("Simulation Date : " + str(datetime.datetime.now()) + "\n")
    file.write("**********\n")
    file.write(Title + " Model\n\n")
    file.write("**********\n")
    file.write("Simulation Inputs : \n\n")
    Input_Keys = list(InputDict.keys())
    Input_Keys.sort()
    for key in Input_Keys:
        file.write(key + " : " + str(InputDict[key]) + "\n")
    file.write("**********\n")
    return file
Exemplo n.º 18
0
async def art(message, text):
    if len(text) > 20:
        message.reply("Ты шизик.")
        return

    art = text2art(text, chr_ignore=True)
    await message.reply(code(art), parse_mode="HTML")
Exemplo n.º 19
0
    def initGame(self, args):

        # read rules from rules file
        rules_file = args['--rules']
        if not rules_file:
            exit(
                "ERROR: Please specify a rules document through the -r option."
            )
        self.readRules(rules_file)

        # make players
        num_people = args['--people']
        num_npcs = args['--npcs']

        # print welcome screen
        os.system('cls' if os.name == 'nt' else 'clear')
        print(art.text2art("Crazy Eights", chr_ignore=True))
        print("Welcome to Crazy Eights!")
        print()
        print("Rules -- specified from `{}`".format(rules_file))
        print("--------------------------------------------------")
        for effect in EFFECTS:
            self.printRule(effect)
        print()
        input("Press [Enter] to continue...")
        print()

        # make people
        print("Creating players...")
        print()
        if num_people:
            for i in range(int(num_people)):
                self.players.append(Person(self))

        # make NPCs
        if num_npcs:
            for i in range(int(num_npcs)):
                self.players.append(NPC(self))

        # # of players can't be over 6
        MAX_PLAYERS = 6
        if len(self.players) == 0:
            exit("ERROR: Number of players cannot be 0.")
        if len(self.players) > MAX_PLAYERS:
            exit(
                "ERROR: Cannot have more than {} players.".format(MAX_PLAYERS))

        # init deck and discard pile
        self.deck = pd.Deck()
        self.deck.shuffle()
        self.discard = pd.Deck()
        self.discard.empty()

        # distribute hands
        NUM_STARTING_CARDS = 5
        for player in self.players:
            player.drawCards(NUM_STARTING_CARDS)
            printCards(player.hand)

        self.gameLoop()
Exemplo n.º 20
0
 def boot(self, indent=None, scan=True):
     logo = art.text2art(CLI_TITLE, font=CLI_FONT).replace('\r\n', '\n')
     newlogo = []
     for logo_ln in logo.split('\n'):
         logo_ln = logo_ln.center(CLI_WIDTH, ' ')
         newlogo.append(logo_ln)
     newlogo_s = '\n'.join(newlogo)
     scan_print(newlogo_s, speed=5) if scan else self.print(newlogo_s)
Exemplo n.º 21
0
 def print(self, output: str) -> None:
     if self._closed:
         raise RuntimeError('Printer is Closed.')
     self._win.clear()
     art = text2art(output, font='lcd').split("\n")
     for index, a in enumerate(art, 0):
         self._win.addstr(index, 0, a, curses.COLOR_BLUE)
     self._win.refresh()
Exemplo n.º 22
0
def show_opener() -> None:
    """
    Show logo art
    :return: None
    """
    text = text2art("osint-framework", font="cjk", chr_ignore=True)
    console = Console()
    console.print(Panel(text, expand=False, border_style="red", box=box.DOUBLE))
Exemplo n.º 23
0
    def get(self):
        rsp = {'code': 0, 'data': ''}

        text = request.args.get('text')
        name = request.args.get('styleName')
        Art = text2art(text, font=name, chr_ignore=False)
        rsp['data'] = Art
        return rsp
Exemplo n.º 24
0
def pong(request):
    user_input = request.GET.get('inputText')
    art_text = a.text2art(user_input)
    data = {
        'success': True,
        'art_text': art_text,
    }
    return JsonResponse(data)
Exemplo n.º 25
0
 def do_banner(self, args):
     ascii_text = text2art("WebPocket", "rand")
     self.poutput("\n\n")
     self.poutput(ascii_text, '\n\n', color=Fore.LIGHTCYAN_EX)
     self.poutput("{art} WebPocket has {count} modules".format(
         art=art("inlove"), count=self.get_module_count()),
                  "\n\n",
                  color=Fore.MAGENTA)
Exemplo n.º 26
0
 def finish_game(self):
     window.clear()
     window.refresh()
     Art = text2art("game over", "random")
     print(Art)
     time.sleep(5)
     curses.endwin()
     quit()
Exemplo n.º 27
0
def pause_screen(w, h):
    stdscr.clear()
    text = text2art("Pause", "small")
    print_multiple_lines((h // 2) - 3, w // 2 - 12, text)

    print_centered(w, h, "press 'm' to resume")
    print_centered(w, h + 2, "press 'q' to go back to the menu")
    stdscr.refresh()
    return navigation_key_press()
Exemplo n.º 28
0
    def __init__(self,
                 capture=None,
                 front_wheels=None,
                 back_wheels=None,
                 camera_control=None,
                 debug=False,
                 mode='drive',
                 model=None):
        """

        :param capture:
        :param front_wheels:
        :param back_wheels:
        :param camera_control:
        :param debug:
        :param mode:
        :param model:
        """

        try:
            from art import text2art
            print(text2art("MLiS AutoPilot"))
        except ModuleNotFoundError:
            print('MLiS AutoPilot')

        assert mode in ['test', 'camera', 'drive']

        # Try getting camera from already running capture object, otherwise get a new CV2 video capture object
        if mode != 'test':
            try:
                self.camera = capture.camera
            except:
                self.camera = cv2.VideoCapture(0)

        # These are picar controls
        self.front_wheels = front_wheels
        self.back_wheels = back_wheels
        self.camera_control = camera_control

        self.debug = debug
        self.mode = mode

        # Thread variables
        self._started = False
        self._terminate = False
        self._thread = None

        # NN Model
        if model is None:
            model = api_settings.MODEL
        print('Using %s model' % model)
        try:
            module = importlib.import_module('autopilot.models.%s.model' %
                                             model)
            self.model = module.Model()
        except:
            raise ValueError('Could not import model')
Exemplo n.º 29
0
def display_path(args: argparse.Namespace):
    art = text2art('IP2LOC', font='epic')
    logging.info(f'\n{art}')

    if args.showpath:
        _display_path(args)
    else:  # path abbr
        logging.info(f'CONFIGURE FILE: {args.config}')
        logging.info(f'LOG FILE: {CONFIG.LOGGING.LOG_FILE_LOC}')
Exemplo n.º 30
0
def _ascii_flare():
    """
    Draw Pr0t0mate banner !!!
    """
    text = "protomate"
    ascii_color = fg(123, 239, 178)
    ascii_style = art.text2art(text, font="glenyn-large")
    ascii_banner = ascii_color + ascii_style + fg.rs
    cprint(ascii_banner, attrs=["bold"])