def add(git_remote): """Add a new repository to look for Dockerfiles""" git_remote = parse(git_remote) if git_remote.valid: repo_name = f'{git_remote.owner}_{git_remote.repo}' destination = settings.REPO_DIR.joinpath(repo_name) if destination.exists(): if click.confirm( crayons.cyan( 'That repo is already added, do you want me to add it again?' )): click.echo( crayons.red('Removing existing repo' + settings.LOADING)) shutil.rmtree(destination) else: raise click.Abort click.echo('{0} {1}{2}'.format( crayons.white('Adding repository', bold=True), crayons.green(repo_name), crayons.white(settings.LOADING, bold=True))) click.echo(f'repo dir - {str(destination)}') with Halo(): git.Repo.clone_from(git_remote.url2git, str(destination)) click.echo( crayons.cyan('Successfully added repository ', bold=True) + crayons.green(repo_name)) else: click.echo( crayons.red("I don't think that's a valid git remote url, sorry."))
def format_help(help): """Formats the help string.""" help = help.replace("Options:", str(crayons.white("Options:", bold=True))) help = help.replace( "Usage: pycake", str("Usage: {0}".format(crayons.white("pycake", bold=True)))) help = help.replace(" prepare", str(crayons.green(" prepare", bold=True))) help = help.replace(" release", str(crayons.red(" release", bold=True))) additional_help = """ Usage Examples: Prepare the stuff for start new Python project $ {0} Release the project as REST APP $ {1} Release the project as REST APP with Dockerfile $ {2} Commands:""".format( crayons.green("pycake prepare"), crayons.red("pycake release"), crayons.red("pycake release --docker"), ) help = help.replace("Commands:", additional_help) return help
def observe(self, resource, feed): self.clear_seen_messages() if type(resource) == Event and resource.reason == "FailedKillPod": msg_key = resource.namespace + resource.name now = arrow.now() if self.has_been_seen(msg_key, now) or resource.last_seen < self.since: return self.seen_messages[msg_key] = now print(crayons.white("{:*^80}".format("Failed to kill pod"))) print(f"Pod: {resource.name}") print(f"Killed: {resource.last_seen.format(DATE_FORMAT)}") print(resource.message) print(crayons.white("*" * 80)) msg = "\n".join([ ":super_saiyan: *Failed to kill pod* :super_saiyan:", f"Namespace: {resource.namespace}", f"Pod: {resource.name}", "```%s```" % " ".join(resource.message.split("\n")) ]) self.slack.send_message(msg)
def sleep_intervals(wait_period=120, sleep_interval=5): if wait_period == 0: logging.warning(crayons.yellow('Wait period: No wait')) return for counter in range(0, wait_period, sleep_interval): print(crayons.white('Time elapsed: ') + crayons.yellow(counter) + crayons.white(' seconds.')) time.sleep(sleep_interval)
def googleAnswer(question): try: # Specify the url url = 'https://www.google.com/search?' query = { 'q' : question} url += urllib.urlencode(query) header = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36' } # This packages the request (it doesn't make it) request = urllib2.Request(url, headers=header) # Sends the request and catches the response response = urllib2.urlopen(request) # Extracts the response html = response.read() # data-tts-text="Mauna Kea" pattern = re.compile("data-tts=\"answers\" data-tts-text=\"(.*?)\"") match = pattern.search(html) if match is not None: print crayons.yellow('Find answer: ' + match.group(1)) else: print crayons.white('No direct answer.') except: print 'googleAnswer fails'
def _pretty_print(self): """Method to pretty print the pipeline.""" print('') print(crayons.green(self.name, bold=True)) if not self.job_map: print(crayons.red('No jobs added to the pipeline yet !')) return joblen = len(self.job_map) for i, jobs in enumerate(self.job_map.values()): print(crayons.blue(u'| ')) if len(jobs) == 1: print(crayons.blue(u'\u21E8 ') + crayons.white(jobs[0].name)) else: if i == joblen - 1: pre = u' ' else: pre = u'| ' l1 = [u'-' * (len(j.name) + 2) for j in jobs] l1 = u''.join(l1) l1 = l1[:-len(jobs[-1].name) // 2 + 1] print(crayons.blue(u'\u21E8 ') + crayons.blue(l1)) fmt = u'{0:^{wid}}' l2 = [fmt.format(u'\u21E9', wid=len(j.name) + 2) for j in jobs] print(crayons.blue(pre) + crayons.blue(u''.join(l2))) l3 = [fmt.format(j.name, wid=len(j.name) + 2) for j in jobs] print(crayons.blue(pre) + crayons.white(u''.join(l3))) pipes = filter(lambda x: isinstance(x, Pipe), chain(*self.job_map.values())) for item in pipes: item._pretty_print()
def update(ctx, state, bare=False, dry_run=None, outdated=False, **kwargs): """Runs lock, then sync.""" from ..core import ( ensure_project, do_outdated, do_lock, do_sync, project, ) ensure_project(three=state.three, python=state.python, warn=True, pypi_mirror=state.pypi_mirror) if not outdated: outdated = bool(dry_run) if outdated: do_outdated(pypi_mirror=state.pypi_mirror) packages = [p for p in state.installstate.packages if p] editable = [p for p in state.installstate.editables if p] if not packages: echo("{0} {1} {2} {3}{4}".format( crayons.white("Running", bold=True), crayons.red("$ pipenv lock", bold=True), crayons.white("then", bold=True), crayons.red("$ pipenv sync", bold=True), crayons.white(".", bold=True), )) else: for package in packages + editable: if package not in project.all_packages: echo( "{0}: {1} was not found in your Pipfile! Aborting." "".format( crayons.red("Warning", bold=True), crayons.green(package, bold=True), ), err=True, ) ctx.abort() do_lock( clear=state.clear, pre=state.installstate.pre, keep_outdated=state.installstate.keep_outdated, pypi_mirror=state.pypi_mirror, ) do_sync( ctx=ctx, dev=state.installstate.dev, three=state.three, python=state.python, bare=bare, dont_upgrade=not state.installstate.keep_outdated, user=False, clear=state.clear, unused=False, sequential=state.installstate.sequential, pypi_mirror=state.pypi_mirror, )
def print_translations(translations, limit): if len(translations) == 0: return print (crayons.white("Translation:")) for i, translation in enumerate(translations): print (crayons.white("\t - {}".format(translation))) if i > limit: break
def create_db(db_path=settings.DATABASE, force_delete=False, verbose=True): if os.path.isfile(db_path): if not force_delete: print( crayons.red( f'''Database {db_path} already exists. If you continue it will be DESTROYED!! Continue? [y/N] ''', bold=True, ), end='', ) if force_delete: option = 'y' if verbose: print(crayons.cyan(f'{os.linesep}Force delete enabled')) else: option = input() if option.upper() == 'Y': os.remove(db_path) if verbose: print('{} {} {}'.format( 'Database', crayons.white(db_path, bold=True), crayons.green('successfully deleted!'), )) else: sys.exit() conn, cur = init_db(db_path) # table of news cur.execute(''' CREATE TABLE news (title text, date text, url text, summary text, category text, saved_at datetime, tg_msg_id int unique) ''') conn.commit() if verbose: print('{} {} {}'.format( 'Database', crayons.white(db_path, bold=True), crayons.green('successfully created!'), )) print('{} {} {}'.format( 'Table', crayons.white('news', bold=True), crayons.green('successfully created!'), )) return conn, cur
def observe(self, resource, feed): if type(resource) == Event and resource.reason == "SystemOOM": print(crayons.white("{:*^80}".format("SYSTEM OOM"))) print(f"Node: {resource.node}") print(f"Killed: {resource.last_seen.format(DATE_FORMAT)}") print(crayons.white("*" * 80)) msg = "\n".join([ ":siren: *POD OOM* :siren:", f"Node: {resource.node}", ]) self.slack.send_message(msg)
def _pprint_outputs(t, verbose=False): print(crayons.blue("Outputs", bold=True)) for p in t: output = t[p] if 'Export' in output: a = list(output['Export']['Name'].keys())[0] print("{}{}".format( crayons.white(" {}\n Exported as ".format(p), bold=True), crayons.red("{}".format(crayons.red(output['Export']['Name']))))) else: print(crayons.white(" {}".format(p), bold=True))
def update(ctx, three=None, python=False, system=False, verbose=False, clear=False, keep_outdated=False, pre=False, dev=False, bare=False, sequential=False, package=None, dry_run=None, outdated=False, more_packages=None): from . import core core.ensure_project(three=three, python=python, warn=True) if not outdated: outdated = bool(dry_run) if outdated: core.do_outdated() if not package: click.echo('{0} {1} {2} {3}{4}'.format( crayons.white('Running', bold=True), crayons.red('$ pipenv lock', bold=True), crayons.white('then', bold=True), crayons.red('$ pipenv sync', bold=True), crayons.white('.', bold=True), )) # Load the --pre settings from the Pipfile. if not pre: pre = core.project.settings.get('pre') core.do_lock(verbose=verbose, clear=clear, pre=pre, keep_outdated=keep_outdated) core.do_sync( ctx=ctx, install=install, dev=dev, three=three, python=python, bare=bare, dont_upgrade=False, user=False, verbose=verbose, clear=clear, unused=False, sequential=sequential ) else: for package in ([package] + list(more_packages) or []): if package not in core.project.all_packages: click.echo( '{0}: {1} was not found in your Pipfile! Aborting.' ''.format( crayons.red('Warning', bold=True), crayons.green(package, bold=True) ), err=True ) sys.exit(1) core.ensure_lockfile(keep_outdated=core.project.lockfile_exists) # Install the dependencies. core.do_install( package_name=package, more_packages=more_packages, dev=dev, three=three, python=python, system=system, lock=True, ignore_pipfile=False, skip_lock=False, verbose=verbose, requirements=False, sequential=sequential, pre=pre, code=False, deploy=False, keep_outdated=True, selective_upgrade=True )
def do_report(rows): path = Path.cwd().joinpath("env-diff.md") utils.write_markdown(rows, path) click.echo(green("Created Markdown report: ") + white(f"{path}", bold=True), err=True) path = Path.cwd().joinpath("env-diff.csv") utils.write_csv(rows, path) click.echo(green("Created CSV report: ") + white(f"{path}", bold=True), err=True)
def config(context): conf = context.obj click.echo('{}: {}'.format(crayons.blue('Filename'), conf.filename)) click.echo('{}: {}'.format(crayons.blue('Extension'), conf.extension)) click.echo(crayons.blue('Services:')) for service in conf.services: click.echo(crayons.white('\n · {}'.format(service), bold=True)) for attribute in SERVICE_ATTRIBUTES: click.echo(' {}: {}'.format( crayons.white(attribute, bold=True), getattr(conf.services.get(service), attribute) ))
def cli(template, verbose=False, validate=False, version=False): click.echo(_greeter(), err=True) if version: sys.exit(0) print("{}: {}".format( crayons.white("Inspecting template", bold=True), crayons.blue(template.name))) template = template.read() try: t = json.loads(template) except Exception as e: pass try: json_template = to_json(template) t = json.loads(json_template) except Exception as e: click.echo( "Could not determine the input format or format not sane: {}".format(e), err=True) sys.exit(1) if 'Description' in t: print("{}: {}".format( crayons.white("Description", bold=True), crayons.white("{}".format(t['Description']), bold=False))) if 'Parameters' in t: _pprint_parameters(t['Parameters'], verbose=verbose) if 'Mappings' in t and verbose: _pprint_mappings(t['Mappings']) if 'Conditions' in t: _pprint_conditions(t['Conditions'], verbose=verbose) if 'Resources' in t: _pprint_resources(t['Resources'], verbose=verbose) if 'Outputs' in t: _pprint_outputs(t['Outputs'], verbose=verbose) if validate: if len(template) > 51200: click.echo( crayons.red("Can't validate the template AWS - template size exceeds 51200 bytes"), err=True) sys.exit(1) try: result = _boto_validate(template) if result[0] == True: print(crayons.cyan("Yay ! template is valid", bold=True)) else: print(crayons.cyan(":(, template is not valid: {}".format(result[1]), bold=True)) except Exception as e: click.echo(crayons.red("Problem with boto3 connection, {}".format(e)), err=True) sys.exit(1) sys.exit(0)
def execute_task(task, *, next_task=None, silent=False): if not silent: click.echo( crayons.white(" + ") + crayons.yellow(f"Executing {task}") + crayons.white(":")) return_code = task.execute(yes=yes, next_task=next_task, silent=silent) if fail: if not return_code == 0: click.echo(f"Task {task} failed!") sys.exit(return_code)
def observe(self, resource, feed): if type(resource) == Event and resource.reason == "FailedKillPod": print(crayons.white("{:*^80}".format("Failed to kill pod"))) print(f"Pod: {resource.name}") print(f"Killed: {resource.last_seen.format(DATE_FORMAT)}") print(resource.message) print(crayons.white("*" * 80)) msg = "\n".join([ ":super_saiyan: *POD OOM* :super_saiyan:", f"Namespace: {resource.namespace}", f"Pod: {resource.name}", resource.message ]) self.slack.send_message(msg)
def output_helm_options(kube_cluster: 'KubeCluster'): print( crayons.white( f'Helm Version: {kube_cluster.cluster_attributes.helm.version.value}' )) print( crayons.white('Initially Install Helm Locally: ') + colorize_yes_or_no( msg='Yes' if kube_cluster.cluster_attributes.helm.local else 'No', yes=kube_cluster.cluster_attributes.helm.local)) print( crayons.white('Initially Deploy Tiller: ') + colorize_yes_or_no( msg='Yes' if kube_cluster.cluster_attributes.helm.tiller else 'No', yes=kube_cluster.cluster_attributes.helm.tiller)) print('')
def do_init(): config, created = utils.init_config() if created: click.echo( green("Generated config file: ") + white(f"{config.path}", bold=True)) else: click.echo( yellow("Config file already exists: ") + white(f"{config.path}", bold=True)) click.echo(cyan("Edit this file to match your application")) sys.exit(0)
def print_examples(examples, frm, dst, limit=5): if len(examples) == 0: return print (crayons.white("Example:")) for i, example in enumerate(examples): example = list(map(lambda x: BeautifulSoup(x, "lxml").get_text(), example)) if frm == 'eng' and dst == 'jpn': print (crayons.white("\tENG - {}".format(example[0]))) print (crayons.white("\tJPN - {}".format(example[1]))) elif frm == 'jpn' and dst == 'eng': print (crayons.white("\tJPN - {}".format(example[0]))) print (crayons.white("\tENG - {}".format(example[1]))) if i > limit: break print()
def get_all_vm_allocated_ips_all_nodes(self): allocated = set() try: nodes = self.get_cluster_nodes() except Exception as disconnected: logging.warning(crayons.yellow(disconnected)) time.sleep(5) nodes = self.get_cluster_nodes() for node_instance in nodes: node = node_instance.get('name') vms = self.get_cluster_vms(node) if not vms: continue for vm in vms: ipconfig0 = self.get_ip_config_from_vm_cloudinit( node=node, vmid=vm.get('vmid'), ipconfig_slot=0) ipconfig1 = self.get_ip_config_from_vm_cloudinit( node=node, vmid=vm.get('vmid'), ipconfig_slot=1) allocated.add(ipconfig0[0]) allocated.add(ipconfig1[0]) allocated.remove(None) print(crayons.white(f'Cloudinit allocated ips: {allocated}')) return allocated
def cli(ctx, find=False, which=False, findall=False, version=False): if version: click.echo("{0} version {1}".format( crayons.white("PythonFinder", bold=True), crayons.yellow(__version__))) sys.exit(0) finder = Finder() if find: if any([find.startswith("{0}".format(n)) for n in range(10)]): found = finder.find_python_version(find.strip()) else: found = finder.system_path.python_executables if found: click.echo("Found Python Version: {0}".format(found), color="white") sys.exit(0) else: click.echo("Failed to find matching executable...") sys.exit(1) elif which: found = finder.system_path.which(which.strip()) if found: click.echo("Found Executable: {0}".format(found), color="white") sys.exit(0) else: click.echo("Failed to find matching executable...") sys.exit(1) else: click.echo("Please provide a command", color="red") sys.exit(1) sys.exit()
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 build(context, service_names): configuration = context.obj stage = 'build' # Filter services if service_names: services = configuration.services.filter(service_names).values() else: services = configuration.services.values() # Initiate subprocesses [s.exec(stage) for s in services] # Wait for all processes to finish for service in services: if service.subprocess: msg = '{} | Executing build stage.' spinner.start(text=crayons.white(msg.format(service.name))) service.subprocess.wait() if service.subprocess.returncode == SUCCESS_EXIT_CODE: msg = '{} | Successfully executed build stage.' spinner.succeed(crayons.green(msg.format(service.name))) else: msg = ( '{} | Error while executing build stage. ' 'Checkout the error log for more details.' ) spinner.fail(crayons.red(msg.format(service.name))) else: msg = '{} | No build stage defined.' click.echo(crayons.yellow(msg.format(service.name)))
def ctr_enrich_observe( access_token, MISSION14, host=env.THREATRESPONSE.get("host"), ): print( white( "\n==> Fetching Sightings about provided observables from CTR modules. Be patient, it may take time..." )) url = f"https://{host}/iroh/iroh-enrich/observe/observables" headers = { "Authorization": f"Bearer {access_token}", 'Content-Type': 'application/json', 'Accept': 'application/json' } observe_payload = json.dumps(observable) response = requests.post(url, headers=headers, data=observe_payload) response.raise_for_status() data = response.json()["data"] return data
def Falta(profesores): #Funcion que sustituye a los profesores. print('') print(crayons.white('Profesores guardados :')) for t in range(0, len(profesores)): print(crayons.green(profesores[t].nombre)) print('') aux = str(input(crayons.green('Nombre '))) aux = '$' + aux for k in range(0, len(profesores)): if aux == profesores[k].nombre: aux2 = k break dia = int( input(crayons.green('Día de la falta [L(1),M(2),X(3),J(4),V(5)] '))) hora = int( input(crayons.green('Hora falta [1,2,3,4,5,6] '))) hora -= 1 materia = profesores[aux2].hour[dia][hora] for i in range(0, len(profesores) ): #Busca si un profesor tiene clase ese dia con ese curso for j in range(0, 6): if profesores[i].hour[dia][j] == materia: profesores[i].d = True print('') for ii in range(0, len(profesores)): if profesores[ii].d and profesores[ii].hour[dia][hora] == 'LIBRE': print(crayons.blue(profesores[ii].nombre), crayons.blue('puede sustitur'))
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 query(self): if not self.instances: return False for instance in self.instances: instance: InstanceClone query = VMQuery(client=settings.vm_client, name=instance.vm_attributes.name, pool=instance.vm_attributes.pool, node=instance.vm_attributes.node) answer = query.execute() answermsg = f'VMID: {answer[0].vmid}, Name: {answer[0].vm_attributes.name}' if answer else 'Not Found' print( crayons.white( f'Query instance {instance.vm_attributes.name}: {answermsg}' )) created_instance = answer[0] if answer else answer if created_instance: vms_state = self.state[instance.vm_attributes.node] match = lambda vm: vm.get('name') and vm.get( 'name') == created_instance.vm_attributes.name member = list(filter(match, vms_state))[0] index = vms_state.index(member) if member else None self.instances[self.instances.index( instance)] = created_instance if index is not None: self.state[instance.vm_attributes.node][index] = { 'name': created_instance.vm_attributes.name, 'vmid': created_instance.vmid, 'exists': True } for node in self.nodes: if any(item['exists'] for item in self.state[node]): return True return False
def __repr__(self): return "%s %s: [%s] %s" % ( self.started.format(DATE_FORMAT), colorit(self.namespace), self.status, crayons.white(self.name) )
def generate_predictions_tree(history, distance=3, suppress_output=True, render=False): prediction_tree = {} for exchange, crypto_pairs in history.items(): print(crayons.cyan(' predicting {} hours into the future for {} exchange...'.format(distance, exchange))) prediction_tree[exchange] = {} figures = [] for exchange_pair, rates in crypto_pairs.items(): (from_, to) = exchange_pair df = pandas.DataFrame(rates) df.columns = ['y', 'ds'] with suppress_stdout_stderr(suppress_output): ml = Prophet() ml.fit(df) future = ml.make_future_dataframe(periods=distance, freq='1H', include_history=False) forecast = ml.predict(future) if render: label = '{} {}/{}'.format(exchange, from_, to) figure = ml.plot(forecast, xlabel='time', ylabel=label) figure.suptitle(label) figures.append(figure) forecast_set = forecast[['yhat']] tuple_list = [(x[0], 0) for x in forecast_set.values] tuple_list = [ ( df['y'][df.index[-1]], 0 ) ] + tuple_list # add t=now back in prediction_tree[exchange][exchange_pair] = tuple_list if render: for figure in figures: figure.show() print(crayons.white(' (enter to continue, "skip" to skip rest) '), end='') i = input() render = (i != 'skip') return prediction_tree
def cli(ctx, find=False, which=False, findall=False, version=False): if version: click.echo( "{0} version {1}".format( crayons.white("PythonFinder", bold=True), crayons.yellow(__version__) ) ) sys.exit(0) finder = Finder() if find: if any([find.startswith("{0}".format(n)) for n in range(10)]): found = finder.find_python_version(find.strip()) else: found = finder.system_path.python_executables if found: click.echo("Found Python Version: {0}".format(found), color="white") sys.exit(0) else: click.echo("Failed to find matching executable...") sys.exit(1) elif which: found = finder.system_path.which(which.strip()) if found: click.echo("Found Executable: {0}".format(found), color="white") sys.exit(0) else: click.echo("Failed to find matching executable...") sys.exit(1) else: click.echo("Please provide a command", color="red") sys.exit(1) sys.exit()
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"))
def update( ctx, three=None, python=False, pypi_mirror=None, system=False, verbose=False, clear=False, keep_outdated=False, pre=False, dev=False, bare=False, sequential=False, package=None, dry_run=None, outdated=False, more_packages=None, ): from .core import ( ensure_project, do_outdated, do_lock, do_sync, project, ) ensure_project(three=three, python=python, warn=True, pypi_mirror=pypi_mirror) if not outdated: outdated = bool(dry_run) if outdated: do_outdated(pypi_mirror=pypi_mirror) if not package: echo( "{0} {1} {2} {3}{4}".format( crayons.white("Running", bold=True), crayons.red("$ pipenv lock", bold=True), crayons.white("then", bold=True), crayons.red("$ pipenv sync", bold=True), crayons.white(".", bold=True), ) ) else: for package in [package] + list(more_packages) or []: if package not in project.all_packages: echo( "{0}: {1} was not found in your Pipfile! Aborting." "".format( crayons.red("Warning", bold=True), crayons.green(package, bold=True), ), err=True, ) sys.exit(1) do_lock( verbose=verbose, clear=clear, pre=pre, keep_outdated=keep_outdated, pypi_mirror=pypi_mirror, ) do_sync( ctx=ctx, dev=dev, three=three, python=python, bare=bare, dont_upgrade=False, user=False, verbose=verbose, clear=clear, unused=False, sequential=sequential, pypi_mirror=pypi_mirror, )