How to use the pipenv.patched.crayons.white function in pipenv

To help you get started, we’ve selected a few pipenv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pypa / pipenv / pipenv / core.py View on Github external
if line.split("==")[0] in BAD_PACKAGES and not reverse:
                    continue

                # Bold top-level packages.
                if not line.startswith(" "):
                    click.echo(crayons.normal(line, bold=True))
                # Echo the rest.
                else:
                    click.echo(crayons.normal(line, bold=False))
    else:
        click.echo(c.out)
    if c.return_code != 0:
        click.echo(
            "{0} {1}".format(
                crayons.red("ERROR: ", bold=True),
                crayons.white("{0}".format(c.err, bold=True)),
            ),
            err=True,
        )
    # Return its return code.
    sys.exit(c.return_code)
github pypa / pipenv / pipenv / operations / update.py View on Github external
package, more_packages, three, python, pypi_mirror, verbose, clear,
    keep_outdated, pre, dev, bare, sequential, dry_run, outdated,
):
    ensure_project(three=three, python=python, warn=True)
    if not outdated:
        outdated = bool(dry_run)
    if outdated:
        _do_outdated(pypi_mirror=pypi_mirror)
    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),
            )
        )
    else:
        for package in ([package] + list(more_packages)):
            if package not in 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)
    do_lock(
        verbose=verbose, clear=clear, pre=pre,
github pypa / pipenv / pipenv / core.py View on Github external
crayons.red(
                        "Your Pipfile.lock ({0}) is out of date. Expected: ({1}).".format(
                            old_hash[-6:], new_hash[-6:]
                        )
                    )
                )
                raise exceptions.DeployException
                sys.exit(1)
            elif (system or allow_global) and not (PIPENV_VIRTUALENV):
                click.echo(
                    crayons.red(fix_utf8(
                        "Pipfile.lock ({0}) out of date, but installation "
                        "uses {1}… re-building lockfile must happen in "
                        "isolation. Please rebuild lockfile in a virtualenv. "
                        "Continuing anyway…".format(
                            crayons.white(old_hash[-6:]), crayons.white("--system")
                        )),
                        bold=True,
                    ),
                    err=True,
                )
            else:
                if old_hash:
                    msg = fix_utf8("Pipfile.lock ({0}) out of date, updating to ({1})…")
                else:
                    msg = fix_utf8("Pipfile.lock is corrupted, replaced with ({1})…")
                click.echo(
                    crayons.red(msg.format(old_hash[-6:], new_hash[-6:]), bold=True),
                    err=True,
                )
                do_lock(
                    system=system,
github pypa / pipenv / pipenv / operations / graph.py View on Github external
if line.split('==')[0] in BAD_PACKAGES and not reverse:
                    continue

                # Bold top-level packages.
                if not line.startswith(' '):
                    click.echo(crayons.normal(line, bold=True))
                # Echo the rest.
                else:
                    click.echo(crayons.normal(line, bold=False))
    else:
        click.echo(c.out)
    if c.return_code != 0:
        click.echo(
            '{0} {1}'.format(
                crayons.red('ERROR: ', bold=True),
                crayons.white('{0}'.format(c.err, bold=True)),
            ),
            err=True
        )
    # Return its return code.
    sys.exit(c.return_code)
github pypa / pipenv / pipenv / exceptions.py View on Github external
def show(self, file=None):
        if file is None:
            file = vistir.misc.get_text_stderr()
        click_echo("{0} {1}".format(
            crayons.red("Error running command: "),
            crayons.white(decode_for_output("$ {0}".format(self.cmd), file), bold=True)
        ), err=True)
        if self.out:
            click_echo("{0} {1}".format(
                crayons.white("OUTPUT: "),
                decode_for_output(self.out, file)
            ), err=True)
        if self.err:
            click_echo("{0} {1}".format(
                crayons.white("STDERR: "),
                decode_for_output(self.err, file)
            ), err=True)
github pypa / pipenv / pipenv / operations / update.py View on Github external
def do_update(
    package, more_packages, three, python, pypi_mirror, verbose, clear,
    keep_outdated, pre, dev, bare, sequential, dry_run, outdated,
):
    ensure_project(three=three, python=python, warn=True)
    if not outdated:
        outdated = bool(dry_run)
    if outdated:
        _do_outdated(pypi_mirror=pypi_mirror)
    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),
            )
        )
    else:
        for package in ([package] + list(more_packages)):
            if package not in 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,
github pypa / pipenv / pipenv / exceptions.py View on Github external
(k, getattr(req, k, None)) for k in slots
                        if getattr(req, k, None)
                    ]
                    req_value = "\n".join([
                        "    {0}: {1}".format(k, v) for k, v in slot_vals
                    ])
                elif keys_fn:
                    values = [(k, req.get(k)) for k in keys_fn() if req.get(k)]
                    req_value = "\n".join([
                        "    {0}: {1}".format(k, v) for k, v in values
                    ])
                else:
                    req_value = getattr(req.line_instance, "line", None)
        message = "{0} {1}".format(
            crayons.normal(decode_for_output("Failed creating requirement instance")),
            crayons.white(decode_for_output("{0!r}".format(req_value)))
        )
        extra = [str(req)]
        PipenvException.__init__(self, message, extra=extra)
github pypa / pipenv / pipenv / cli / command.py View on Github external
project,
    )
    ensure_project(
        three=state.three, python=state.python, pypi_mirror=state.pypi_mirror,
        warn=(not state.quiet), site_packages=state.site_packages, clear=state.clear
    )
    if not outdated:
        outdated = bool(dry_run)
    if outdated:
        do_outdated(clear=state.clear, pre=state.installstate.pre, 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,
github pypa / pipenv / pipenv / cli / command.py View on Github external
ensure_project(
        three=state.three, python=state.python, pypi_mirror=state.pypi_mirror,
        warn=(not state.quiet), site_packages=state.site_packages, clear=state.clear
    )
    if not outdated:
        outdated = bool(dry_run)
    if outdated:
        do_outdated(clear=state.clear, pre=state.installstate.pre, 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()