def cmd_pose(self, question, sentence_space): for i in range(len(question)): if i != len(question) - 1: print(("\t%d" % (i)) + crayons.red('.') + ("%s" % (question[i]))) else: print(("\t%d" % (i)) + crayons.red('.') + ("%s" % (question[i])) + crayons.magenta("?")) answer = None done = False while not done: answer = input( crayons.green('.') + crayons.magenta('.') + crayons.blue('.')) if answer == "": print("refusing question.") done = True elif answer.isdigit(): answer_index = int(answer) if answer_index >= 0 and answer_index < len(question): return qt.Qobj(sentence_space[answer_index]) done = True else: print("not enough options!") else: print("use answer #!") return answer
def v_pose(self, question, sentence_space, initial_state=None): print(crayons.red("\t +Z ")) print(crayons.green("\t w +Y ")) print(crayons.blue("\t q quit | e ")) print(crayons.yellow("\t | / ")) print(crayons.magenta("\t | / ")) print(crayons.cyan("\t -X a ________*________ d +X ")) print(crayons.magenta("\t / | ")) print(crayons.yellow("\t / | ")) print(crayons.blue("\t -Y | x save ")) print(crayons.green("\t z s ")) print(crayons.red("\t -Z ")) answer_spheres = [] answer_colors = [ vp.vector(*np.random.rand(3)) for i in range(len(question)) ] for i in range(len(question)): answer_vector = qt.Qobj(sentence_space[i]) answer_vector.dims = [[len(question)], [1]] answer_sphere = MajoranaSphere(len(question), answer_vector,\ color=answer_colors[i],\ star_color=answer_colors[i], tag=question[i]) answer_sphere.visualize() answer_spheres.append(answer_sphere) if initial_state == None: initial_state = qt.Qobj( sum([sentence_space[i] for i in range(len(question))])) decision_sphere = MajoranaSphere(len(question), initial_state) decision_sphere.visualize() save_v_decision = decision_sphere.decide() if save_v_decision: return decision_sphere.state else: return None
def cmd_assign_ordering(self, a, b): print(crayons.red(self.combo_question_string(a))) print("\t.VS.") print(crayons.blue(self.combo_question_string(b))) print(crayons.red("\t coexists ")) print(crayons.green("\t w covers ")) print(crayons.blue("\t q | e ")) print(crayons.yellow("\t defer... | / ")) print(crayons.magenta("\t | / ")) print(crayons.cyan("\t before a _______SUM_______ d after ")) print(crayons.magenta("\t / x ")) print(crayons.yellow("\t is / | p ")) print(crayons.blue("\t covered z | to quit... ")) print(crayons.green("\t by s ")) print(crayons.red("\t excludes ")) ordering = input( crayons.green('.') + crayons.magenta('.') + crayons.blue('.')) while ordering not in ["a", "d", "s", "w", "z", "e", "q", "p"]: if ordering == 'x': if self.questions[a][1].dims != self.questions[b][1].dims: print('wrong dimensions!' ) # add permutations aka word to word mapping! else: return x ordering = input( crayons.green('.') + crayons.magenta('.') + crayons.blue('.')) return ordering
def list(depth=None): tree = get_dependency_tree() # click.echo(json.dumps(tree, indent=4)) piper_file = project.piper_file base_keys = [_key for _key in piper_file["dependencies"]] dev_keys = [_key for _key in piper_file["dev_dependencies"]] click.echo("# " + crayons.green("base = green") + " | " + crayons.magenta("dev = magenta") + " | " + crayons.cyan("sub dependencies = cyan")) for node in tree: name = node["package"]["package_name"] if node["package"]["package_name"].lower() in IGNORED_PACKAGES: continue elif node["package"]["package_name"].lower() in base_keys: name = crayons.green(node["package"]["package_name"]) elif node["package"]["package_name"].lower() in dev_keys: name = crayons.magenta(node["package"]["package_name"]) else: name = crayons.cyan(node["package"]["package_name"]) click.echo("├─ {0}=={1}".format(name, node["package"]["installed_version"])) for dep in node["dependencies"]: version_string = dep["required_version"] or "" click.echo("│ └─ {0}{1}".format(dep["package_name"], version_string)) click.echo( crayons.green( emoji.emojize("\n:sparkles: Package list complete", use_aliases=True)))
def __str__(self): rep = crayons.red( "**************************************************************\n") rep += crayons.magenta("%s:\n" % self.name) rep += crayons.green(" vocabulary:\n") for i in range(len(self.vocabulary)): v = self.vocabulary[i] rep += crayons.blue(" %d.%s\n " % (i, v)) for e in self.symbol_basis[v].full().T[0].tolist(): rep += '[{0.real:.2f}+{0.imag:.2f}i] '.format(e) rep += "\n" rep += crayons.yellow(" concordance_matrix:\n") rep += str(self.concordance_matrix) + "\n" rep += crayons.cyan(" questions:\n") for i in range(len(self.questions)): possible_answers, answer = self.questions[i] rep += crayons.red(" %d.'%s'\n " % (i, ", ".join(possible_answers))) #for e in answer.full().T[0].tolist(): # rep += '[{0.real:.2f}+{0.imag:.2f}i] '.format(e) probs = self.question_to_probabilities(i) #print(probs) for p in probs: rep += "\t%s: %.6f%%\n" % (p[0], p[1]) rep += crayons.magenta(" orderings:\n") for e in self.unordered: rep += "\t.%s\n" % (self.combo_question_string(e)) rep += crayons.yellow(" state:\n") rep += str(self.state) + "\n" rep += crayons.blue( "**************************************************************") return rep
def mainMenu(): clearScreen() print( crayons.red("|*|*|*|*|*|*| Birch Micro IDE " + version + " |*|*|*|*|*|*|")) print(crayons.yellow("1.Editor")) print(crayons.yellow("2.Parser")) print(crayons.yellow("3.Open File")) print(crayons.yellow("4.New File")) print(crayons.yellow("5.Check for errors in code")) print(crayons.green("6.Scan project for files")) menuopt = input(crayons.yellow("\noption [1-3]: ", bold=True)) if menuopt == "1": clearScreen() ffn = input("\n\nfilename: ") editorMain(ffn) if menuopt == "2": clearScreen() print("birch-prompt " + version + " " + platform) return if menuopt == "3": clearScreen() ResizeList(sys.argv, 2, fill_with=0) sys.argv[1] = input("\n\nfilename: ") frmain() if menuopt == "4": clearScreen() nfn = input("\n\nnew filename: ") with open(nfn, "w") as nfile: nfile.write("^== Made with " + crayons.yellow("Birch", bold=True) + crayons.magenta("Micro", bold=True) + crayons.cyan("IDE", bold=True) + "\n") editorMain(nfn) if menuopt == "5": clearScreen() ResizeList(sys.argv, 2, fill_with=0) sys.argv[1] = input("\n\nfilename: ") frmain() if menuopt == "6": clearScreen() inFdir = input("Project Directory: ") filesall = dict() e = 1 print("\n\n") for root, dirs, files in os.walk(os.getcwd() + "/" + inFdir): for file in files: if file.endswith(".bir") or file.endswith(".brc"): print( crayons.magenta( str(e) + ". " + os.path.join(root, file))) filesall[str(e)] = os.path.join(root, file) e += 1 fname = input("\nfile number: ") clearScreen() ResizeList(sys.argv, 2, fill_with=0) sys.argv[1] = str(filesall[fname]).replace(os.getcwd() + "/", "") frmain() sys.exit()
async def log_command(ctx): if ctx.invoked_subcommand: return ts = crayons.white(utils.get_timestamp(), bold=True) msg = crayons.green(ctx.message.content.replace(ctx.prefix, "", 1), bold=True) chan = crayons.magenta(f"#{ctx.channel}", bold=True) guild = crayons.magenta(f"({ctx.guild})") user = crayons.yellow(f"{ctx.author}", bold=True) print(f"{ts} {msg!s} in {chan} {guild} by {user}")
async def clean(ctx: fortnitepy.ext.commands.Context) -> None: await ctx.send('Cleared CMD') clear() print( crayons.magenta( f'███████╗██╗ █████╗ ██████╗ ██████╗ █████╗ ████████╗') ) print( crayons.magenta( f'██╔════╝██║ ██╔══██╗██╔══██╗ ██╔══██╗██╔══██╗╚══██╔══╝') ) print( crayons.magenta( f'█████╗ ██║ ██║ ██║██████╔╝█████╗██████╦╝██║ ██║ ██║ ') ) print( crayons.magenta( f'██╔══╝ ██║ ██║ ██║██╔═══╝ ╚════╝██╔══██╗██║ ██║ ██║ ') ) print( crayons.magenta( f'██║ ███████╗╚█████╔╝██║ ██████╦╝╚█████╔╝ ██║ ') ) print( crayons.magenta( f'╚═╝ ╚══════╝ ╚════╝ ╚═╝ ╚═════╝ ╚════╝ ╚═╝ ') ) print( crayons.red( f'---------------------------------------------------------------------' )) print( crayons.magenta( f'[FLOP BOT] [{time()}] massive shout out to oli for inspiring me') ) print( crayons.magenta( f'[FLOP BOT] [{time()}] Discord server: https://discord.gg/7WrH6r3 ' )) print( crayons.magenta(f'[FLOP BOT] [{time()}] For support, questions, etc')) print( crayons.cyan( f'[FLOP BOT] [{time()}] This bot is in progress, if any issue occurs' )) print( crayons.cyan( f'[FLOP BOT] [{time()}] Please report to the discord ASAP')) print( crayons.red( f'---------------------------------------------------------------------' )) print( crayons.green( f'[FLOP BOT] [{time()}] Client ready as {client.user.display_name}' )) print( crayons.red( f'---------------------------------------------------------------------' ))
def log_pokemon(match, message): p = match.pokemon ts = crayons.white(utils.get_timestamp(), bold=True) cat = crayons.cyan(p.category, bold=True) name = crayons.green(str(p)) score = crayons.red(f"[{match.score}]", bold=True) chan = crayons.magenta(f"#{message.channel}", bold=True) guild = crayons.magenta(f"({message.guild})") print( f"{ts} {cat} {name} {score} (#{str(p.id).zfill(3)} {p.generation}) in {chan} {guild}" )
def display_vprompt(self): self.decider_sphere.display_visuals() for answer_sphere in self.answer_spheres: answer_sphere.display_visuals() print(crayons.red("\t +Z ")) print(crayons.green("\t w +Y ")) print(crayons.blue("\t q quit | e ")) print(crayons.yellow("\t | / ")) print(crayons.magenta("\t | / ")) print(crayons.cyan("\t -X a ________*________ d +X ")) print(crayons.magenta("\t / | ")) print(crayons.yellow("\t / | ")) print(crayons.blue("\t -Y | x save ")) print(crayons.green("\t z s ")) print(crayons.red("\t -Z "))
def format_path(path): """ Format the cycle with colors :param path: :return: str """ if len(path) == 1: # print the node path if it recursively import itself return str(path[0].full_path) elif len(path) > 1: result = [crayons.yellow(path[0].name)] previous = path[0] for item in path[1:]: result.append(' -> ') result.append(crayons.yellow(item.name)) result.append(': Line ') result.append( crayons.cyan(str( item.is_imported_from[previous.full_path][0]))) previous = item result.append(' =>> ') result.append(crayons.magenta(path[0].name)) return ''.join(str(x) for x in result) else: return ''
def _str_value(v, prec=3, colour="white"): """Prints a single value as an optimal decimal valued string. If the crayons module is detected, then it will show the value in colour (unless the global force_no_colour is True).""" s = better_float_str(str(v), tolerance=prec, pre_strip=False).rstrip(".") if len(s): if s[0] != "-": s = " " + s else: s = " " + s if has_crayons and not force_no_colour: if colour.lower() == "red": return str(crayons.red(s)) elif colour.lower() == "green": return str(crayons.green(s)) elif colour.lower() == "blue": return str(crayons.blue(s)) elif colour.lower() == "yellow": return str(crayons.yellow(s)) elif colour.lower() == "magenta": return str(crayons.magenta(s)) elif colour.lower() == "white": return str(crayons.white(s)) else: return str(crayons.cyan(s)) else: return s
def render_graph(self): print(crayons.magenta('render graph', bold=True)) g = gv.AGraph(directed=True, rankdir='LR') def safe_label(s0): s1 = s0.replace('\n', '\\l') s2 = s1.replace('\\"', '\'') #breakpoint() return s2 def f1(n, d, f): if n: h0 = hashlib.md5(n.encode()).hexdigest() for k, v in d.items(): h = hashlib.md5(k.encode()).hexdigest() g.add_node(h, label=safe_label(k)) #print(f'h={h!r}') #print(f'k={k!r}') if n: g.add_edge(h0, h) f(k, v, f1) f1(None, self.graph, f1) g.write('layout.dot') return with open('layout.dot', 'w') as f: f.write(g.string())
def _filter_answer(args): answer_url = _get_link(args['query'][0]) all_answers = _get_answer(args, answer_url) if isinstance(all_answers, str): return all_answers if not args['property']: return all_answers filter_answer = [] if args['property'] == 'n': for answer in all_answers: if answer[0] == 'noun': filter_answer.append(answer) if args['property'] == 'v': for answer in all_answers: if answer[0] == 'verb': filter_answer.append(answer) if args['property'] == 'adj': for answer in all_answers: if answer[0] == 'adj': filter_answer.append(answer) if args['property'] == 'adv': for answer in all_answers: if answer[0] == 'adv': filter_answer.append(answer) if not filter_answer: return crayons.magenta( '\nIt seems, "{}" has no such property.\n'.format( args['query'][0])).color_str return filter_answer
def main(): """Runtime code. Always indent a function""" # print 'red string' in red print(crayons.red('red string')) # Red White and Blue text print('{} white {}'.format(crayons.red('red'), crayons.blue('blue'))) crayons.disable() # disables the crayons package print('{} white {}'.format(crayons.red('red'), crayons.blue('blue'))) crayons.DISABLE_COLOR = False # enable the crayons package # This line will print in color because color is enabled print('{} white {}'.format(crayons.red('red'), crayons.blue('blue'))) # print 'red string' in red print(crayons.red('red string', bold=True)) # print 'yellow string' in yellow print(crayons.yellow('yellow string', bold=True)) # print 'magenta string' in magenta print(crayons.magenta('magenta string', bold=True)) # print 'white string' in white print(crayons.white('white string', bold=True))
def display_txtprompt(self): for i in range(self.n_choices): if i != self.n_choices - 1: print(("\t%d" + crayons.red('.') + "%s") % (i, question[i])) else: print( ("\t%d" + crayons.red('.') + "%s" + crayons.magenta("?")) % (i, question[i])) done = False answer = None while not done: answer = self.sphere_command.display_inner_prompt() if answer == "": print("refusing question.") done = True elif answer.isdigit(): answer_index = int(answer) if answer_index >= 0 and answer_index < self.n_choices: return qt.Qobj(self.question_space[answer_index]) done = True else: self.sphere_command.display_error( message="not enough options for you!") else: self.sphere_command.display_error(message="use answer #!") return answer
def main(): """run time code. Always indent under function""" # print 'red string' in red print(crayons.red('red string', bold=True)) # print 'yellow string' in yellow print(crayons.yellow('yellow string', bold=True)) # print 'magenta string' in magenta print(crayons.magenta('magenta string', bold=True)) # print 'white string' in white print(crayons.white('white string', bold=True)) # print 'black string' in black print(crayons.black('black string', bold=True)) # print 'green string' in green print(crayons.green('green string', bold=True)) # print 'cyan string' in cyan print(crayons.cyan('cyan string', bold=True)) # print 'blue string' in blue print(crayons.blue('blue string', bold=True)) # print 'Lina Do name' in Red print(crayons.red('Lina Do', bold=True))
def test_get_referred(): print("\n") print(cy.magenta("Referred Users", bold=True)) print_line() ref_list = userlib.get_user_info(original_user_email) print(ref_list) pass
def bandwidth(): #Define the function name import crayons from subprocess import call from time import sleep openfile = open("test.csv", "r") #Open the file, "r" to read readfile = openfile.read() #Read the file filesplit = readfile.splitlines() #Separate each row outfile = open("output.txt", "a") #Define a file to output the results to, "a" to append for x in filesplit: #Loop through each row x = x.split(',') speed = x[0] carrier = x[1] message = "The movie is about to begin..." #Define the inital user message if int(x[0]) >= 25: message = f"{message} since your bandwidth is {speed}, and your carrier is {carrier}, we recommend setting video to 4k." #Display the specific message in GREEN print(crayons.green(message, bold=True)) print(message, file=outfile) elif int(x[0]) >= 5: message = f"{message} since your bandwidth is {speed}, and your carrier is {carrier}, we recommend setting video to 1080p." #Display the specific message in YELLOW print(crayons.yellow(message, bold=True)) print(message, file=outfile) elif int(x[0]) >= 2: message = f"{message} since your bandwidth is {speed}, and your carrier is {carrier}, we recommend setting video to 720p." #Display the specific message in RED print(crayons.red(message, bold=True)) print(message, file=outfile) else: message = f"{message} Since your bandwidth is {speed}, and your carrier is {carrier}, we recommend finding another provider." #Display the specific message in MAGENTA print(crayons.magenta(message, bold=True)) print(message, file=outfile) print( "\nAll of the above results have been saved to a file named output.txt" ) #Display a message that shows we are now opening the file print("\n\n\nWe are now opening the file, please wait...") #Wait for 5 seconds sleep(3) #Now display the file that was generated from running the script call(["cat", "output.txt"]) #Show the file exists in this directory print( crayons.green( "\nWe are now showing the file exists in this directory.")) call(["ls", "output.txt"]) sleep(3) #Now lets delete the file that was created print(crayons.green("\nWe are now deleting the file")) call(["rm", "output.txt"]) #Show that the file no longer exists call(["ls", "output.txt"]) sleep(3) print(crayons.green("\nYou can now see the file no longer exists!")) #Clean things up by closing the input and outfile files openfile.close() outfile.close()
def common_instance_clones( instances: List['InstanceClone'], action: KubeClusterAction = KubeClusterAction.create, role='master', vmid_placeholder=9999): symbol = get_action_symbol(action) for instance in instances: if instance.vmid == vmid_placeholder: vmid = crayons.magenta('[Known after apply]') else: vmid = crayons.yellow(instance.vmid) print(create_update_or_delete(msg=symbol, action=action)) print( create_update_or_delete(f'*** {instance.vm_attributes.name} ***', action=action)) print(crayons.blue('Role: ') + crayons.yellow(role)) print( create_update_or_delete('Proxmox Node: ', action=action) + crayons.yellow(instance.vm_attributes.node)) print( create_update_or_delete(f'Username: '******'{instance.username}')) print(create_update_or_delete('VMID: ', action=action) + vmid) vm_output_helper(instance.vm_attributes, action=action) vm_output_hotplug_helper(instance, action=action) print('')
def __init__(self): parser = argparse.ArgumentParser( description= 'A CLI tool to help prune your overgrown requirements file') parser.add_argument('--nocolor', action='store_true', help='turns off colored output') parser.add_argument('--with_exit_code', action='store_true', help='forces exit code to 1 if requirements ' 'needed pruning') parser.add_argument('requirements_file', help='requirements file you want to prune') parser.add_argument('output_file', help='file to store the required requirements') parser.add_argument( 'test_command', nargs='*', help='command to run to test the project still works') self.args = parser.parse_args() self._loadArgs() self.PROMPT = crayons.magenta('PRUNER: ', bold=True) self._getRequirements() self._loadVirtualEnv() self._installRequirements()
def __load_current_info(self): """Load current add-on version information and current config.""" config_files = ("config.json", "config.yaml", "config.yml") for config_file in config_files: if os.path.exists( os.path.join(self.repository.working_dir, self.repository_target, config_file)): self.existing_config_filename = config_file break if self.existing_config_filename is None: click.echo("Current version: %s" % crayons.yellow("Not available")) return False with open( os.path.join( self.repository.working_dir, self.repository_target, self.existing_config_filename, ), "r", encoding="utf8", ) as f: current_config = (json.load(f) if self.existing_config_filename.endswith(".json") else yaml.safe_load(f)) self.current_version = current_config["version"] self.name = current_config["name"] self.description = current_config["description"] self.slug = current_config["slug"] self.url = current_config["url"] if "arch" in current_config: self.archs = current_config["arch"] current_parsed_version = False try: current_parsed_version = semver.parse(self.current_version) except ValueError: pass if current_parsed_version: try: ref = self.addon_repository.get_git_ref("tags/" + self.current_version) except UnknownObjectException: ref = self.addon_repository.get_git_ref("tags/v" + self.current_version) self.current_commit = self.addon_repository.get_commit( ref.object.sha) else: try: self.current_commit = self.addon_repository.get_commit( f"v{self.current_version}") except GithubException: self.current_commit = self.addon_repository.get_commit( self.current_version) click.echo("Current version: %s (%s)" % (crayons.magenta( self.current_version), self.current_commit.sha[:7]))
def soul___(self, soul_name): """soul *name*""" if self.does_soul_exist(soul_name): soul = self.spheres.souls[soul_name] rep = crayons.red( "**************************************************************\n" ) rep += crayons.magenta("%s:\n" % soul.name) rep += crayons.green(" vocabulary:\n") for i in range(len(soul.vocabulary)): v = soul.vocabulary[i] rep += crayons.blue(" %d.%s\n " % (i, v)) for e in soul.symbol_basis[v].full().T[0].tolist(): rep += '[{0.real:.2f}+{0.imag:.2f}i] '.format(e) rep += "\n" rep += crayons.yellow(" concordance_matrix:\n") rep += str(soul.concordance_matrix) + "\n" rep += crayons.cyan(" questions:\n") for i in range(len(soul.questions)): question, answer = soul.questions[i] rep += crayons.red(" %d.'%s'\n " % (i, ", ".join(question))) for e in answer.full().T[0].tolist(): rep += '[{0.real:.2f}+{0.imag:.2f}i] '.format(e) rep += crayons.blue( "**************************************************************" ) print(rep)
def load_repository(self, addon: str): """Load repository configuration from remote repository and add-ons.""" click.echo("Locating repository add-on list...", nl=False) try: config = self.github_repository.get_contents(".addons.yml") except UnknownObjectException: print( "Seems like the repository does not contain an " ".addons.yml file, falling back to legacy file." ) try: config = self.github_repository.get_contents(".hassio-addons.yml") except UnknownObjectException: print( "Seems like the repository does not contain an " ".hassio-addons.yml file either." ) sys.exit(1) config = yaml.safe_load(config.decoded_content) click.echo(crayons.green("Loaded!")) if not config["channel"] in CHANNELS: click.echo( crayons.red( 'Channel "%s" is not a valid channel identifier' % config["channel"] ) ) sys.exit(1) self.channel = config["channel"] click.echo("Repository channel: %s" % crayons.magenta(self.channel)) if addon: click.echo(crayons.yellow('Only updating addon "%s" this run!' % addon)) click.echo("Start loading repository add-ons:") for target, addon_config in config["addons"].items(): click.echo(crayons.cyan("-" * 50, bold=True)) click.echo(crayons.cyan(f"Loading add-on {target}")) self.addons.append( Addon( self.git_repo, target, addon_config["image"], self.github.get_repo(addon_config["repository"]), addon_config["target"], self.channel, ( not addon or addon_config["repository"] == addon or target == addon ), ) ) click.echo(crayons.cyan("-" * 50, bold=True)) click.echo("Done loading all repository add-ons")
def main(start_date: datetime.datetime, end_date: datetime.datetime) -> None: tick = time.time() date_range = pd.date_range(start_date, end_date) for date in date_range: process_quality_control(RID, date, OUTPATH) tock = time.time() print(crayons.magenta(f"Process finished in {tock - tick:0.4}s.")) return None
def setup(self, noinput=False, init_data={}, python=None, virtualenv_location="inside", installable=False): if not self.has_virtualenv: click.secho("Creating virtualenv...", fg="yellow") # self.virtualenv_location = virtualenv_location with click_spinner.spinner(): self.create_virtualenv(python=python, virtualenv_location=virtualenv_location) click.secho("Virtualenv created ✓", fg="green") click.secho("Your virtualenv path: " + crayons.magenta("{}".format(self.virtualenv_dir))) else: click.secho("Virtualenv already exists ✓", fg="green") if not self.has_requirements_structure: click.secho("Creating requirement files...", fg="yellow") self.create_requirements_structure() click.secho("Requirement files created ✓", fg="green") else: click.secho("Requirement files already exists ✓", fg="green") if not self.has_piper_file: click.secho("Creating piper file...", fg="yellow") self.create_piper_file(noinput=noinput, init_data=init_data) click.secho("Piper file created ✓", fg="green") else: click.secho("Piper file already exists ✓", fg="green") if not self.has_piper_lock: click.secho("Creating piper lock...", fg="yellow") self.create_piper_lock() click.secho("Piper lock created ✓", fg="green") else: click.secho("Piper lock already exists ✓", fg="green") if not self.has_setup_py: if (not installable) and (not noinput): wants_setup_py = click.confirm( "Do you want to make the project installable (adding setup.py)?" ) installable = wants_setup_py if installable: self.setup_py_dir.write_text(setup_py_template.text()) click.secho("setup.py created ✓", fg="green") else: click.secho("setup.py creation skipped", fg="yellow") logger.debug([ self.virtualenv_dir, self.piper_file_dir, self.piper_lock_dir, self.requirements_dir ])
def show(msgt): msg=msgt.printing() msg=list(msg) for i in range(len(msg)): if msg[i]=='a': msg[i]=crayons.magenta('a',bold=True) elif msg[i]=='b': msg[i]=crayons.yellow('b',bold=True) for i in msg: print(i,end='')
def display(self): self.sphere_command.vycle() print(crayons.magenta("q to quit...")) for word_sphere in self.word_spheres: word_sphere.visualize() key = self.sphere_command.get_vkey() while key != "q": key = self.sphere_command.get_vkey() for word_sphere in self.word_spheres: del word_sphere
def display_startup_message(self): os.system("clear") print("welcome to %s" % \ crayons.red("s")+\ crayons.white("p")+\ crayons.yellow("h")+\ crayons.green("e")+\ crayons.cyan("r")+\ crayons.blue("e")+\ crayons.magenta("s"))
def format(self, record): s = super().format(record) if record.levelno == logging.DEBUG: return str(magenta(s)) if record.levelno == logging.INFO: return str(green(s)) if record.levelno == logging.WARN: return str(yellow(s)) if record.levelno == logging.ERROR: return str(red(s)) return s
def update_status(config, status, computer, manager): """Update each application's status.""" log.info("Recording application status...") for application in config.applications: latest = status.get_latest(application) if manager.is_running(application): if computer != latest: if status.is_running(application, computer): # case 1: application just launched remotely manager.stop(application) status.stop(application, computer) print(crayons.green( f"{application} is now running on {latest}")) print(crayons.red( f"{application} is now stopped on {computer}")) else: # case 2: application just launched locally status.start(application, computer) print(crayons.green( f"{application} is now running on {computer}")) else: # case 3: application already running locally print(crayons.cyan( f"{application} is running on {computer}")) else: if status.is_running(application, computer): # case 4: application just closed locally status.stop(application, computer) print(crayons.red( f"{application} is now stopped on {computer}")) elif latest: # case 5: application already closed locally print(crayons.magenta( f"{application} is running on {latest}")) else: # case 6: application is not running print(crayons.white( f"{application} is not running"))