当前位置: 首页>>代码示例>>Python>>正文


Python crayons.blue方法代码示例

本文整理汇总了Python中crayons.blue方法的典型用法代码示例。如果您正苦于以下问题:Python crayons.blue方法的具体用法?Python crayons.blue怎么用?Python crayons.blue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在crayons的用法示例。


在下文中一共展示了crayons.blue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: report

# 需要导入模块: import crayons [as 别名]
# 或者: from crayons import blue [as 别名]
def report(self):
        """Method to pretty print the report."""
        print("")
        print(crayons.green(self.name, bold=True))

        if not self.thread_map:
            print(crayons.red("No jobs run in pipeline yet !"))
            return

        joblen = len(self.thread_map)
        for i, jobs in enumerate(self.thread_map.values()):
            print(crayons.blue(u"| "))
            if len(jobs) == 1:
                print(crayons.blue(u"\u21E8  ") + Pipe._cstate(jobs[0]))
            else:
                if i == joblen - 1:
                    pre = u"  "
                else:
                    pre = u"| "
                l1 = [u"-" * 10 for j in jobs]
                l1 = u"".join(l1)
                l1 = l1[:-1]
                print(crayons.blue(u"\u21E8 ") + crayons.blue(l1))
                fmt = u"{0:^{wid}}"
                l2 = [fmt.format(u"\u21E9", wid=12) for j in jobs]
                print(crayons.blue(pre) + crayons.blue(u"".join(l2)))
                l3 = [
                    Pipe._cstate(fmt.format(j.state.name, wid=12))
                    for j in jobs
                ]
                print(crayons.blue(pre) + u"".join(l3))

        pipes = filter(
            lambda x: isinstance(x.job, Pipe), chain(*self.thread_map.values())
        )

        for item in pipes:
            item.job.report() 
开发者ID:csurfer,项目名称:pypette,代码行数:40,代码来源:pipes.py

示例2: _pretty_print

# 需要导入模块: import crayons [as 别名]
# 或者: from crayons import blue [as 别名]
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() 
开发者ID:csurfer,项目名称:pypette,代码行数:37,代码来源:pipes.py

示例3: run_command

# 需要导入模块: import crayons [as 别名]
# 或者: from crayons import blue [as 别名]
def run_command(cmd, *args, **kwargs):
    """
    Take an input command and run it, handling exceptions and error codes and returning
    its stdout and stderr.

    :param cmd: The list of command and arguments.
    :type cmd: list
    :returns: A 2-tuple of the output and error from the command
    :rtype: Tuple[str, str]
    :raises: exceptions.PipenvCmdError
    """

    from pipenv.vendor import delegator
    from ._compat import decode_for_output
    from .cmdparse import Script
    catch_exceptions = kwargs.pop("catch_exceptions", True)
    if isinstance(cmd, (six.string_types, list, tuple)):
        cmd = Script.parse(cmd)
    if not isinstance(cmd, Script):
        raise TypeError("Command input must be a string, list or tuple")
    if "env" not in kwargs:
        kwargs["env"] = os.environ.copy()
    kwargs["env"]["PYTHONIOENCODING"] = "UTF-8"
    try:
        cmd_string = cmd.cmdify()
    except TypeError:
        click_echo("Error turning command into string: {0}".format(cmd), err=True)
        sys.exit(1)
    if environments.is_verbose():
        click_echo("Running command: $ {0}".format(cmd_string, err=True))
    c = delegator.run(cmd_string, *args, **kwargs)
    return_code = c.return_code
    if environments.is_verbose():
        click_echo("Command output: {0}".format(
            crayons.blue(decode_for_output(c.out))
        ), err=True)
    if not c.ok and catch_exceptions:
        raise PipenvCmdError(cmd_string, c.out, c.err, return_code)
    return c 
开发者ID:pypa,项目名称:pipenv,代码行数:41,代码来源:utils.py

示例4: session

# 需要导入模块: import crayons [as 别名]
# 或者: from crayons import blue [as 别名]
def session(self):
        if self._session is None:
            self._session = self.pip_command._build_session(self.pip_options)
            # if environments.is_verbose():
            #     click_echo(
            #         crayons.blue("Using pip: {0}".format(" ".join(self.pip_args))), err=True
            #     )
        return self._session 
开发者ID:pypa,项目名称:pipenv,代码行数:10,代码来源:utils.py

示例5: log

# 需要导入模块: import crayons [as 别名]
# 或者: from crayons import blue [as 别名]
def log(self, *args):
        self.lock.acquire()
        try:
            msg = crayons.blue(f'({self.hostname}): ')
            print(msg, *args)
            sys.stdout.flush()
        finally:
            self.lock.release() 
开发者ID:mlsmithjr,项目名称:transcoder,代码行数:10,代码来源:cluster.py

示例6: colordiff

# 需要导入模块: import crayons [as 别名]
# 或者: from crayons import blue [as 别名]
def colordiff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\n'):
    for i, diff in enumerate(unified_diff(a, b, fromfile, tofile, fromfiledate, tofiledate, n, lineterm)):
        if i < 2:
            yield str(crayons.white(diff, bold=True))
        elif diff.startswith("@"):
            yield str(crayons.blue(diff))
        elif diff.startswith("+"):
            yield str(crayons.green(diff))
        elif diff.startswith("-"):
            yield str(crayons.red(diff))
        else:
            yield diff 
开发者ID:jaksi,项目名称:awslog,代码行数:14,代码来源:__init__.py

示例7: formattext

# 需要导入模块: import crayons [as 别名]
# 或者: from crayons import blue [as 别名]
def formattext():
    print '--' * 38
    print crayons.blue(url)
    print crayons.yellow('Press cmd + double click link to go to link!')
    try:
        print grabhandle() + ' | ' + grabdate() + ' \n' + crayons.green(grabprice()) + ' \n' + grabsku()
        print ' '*38
        grabszstk()
        print crayons.yellow('Press ctrl + z to exit')
    except TypeError:
        print crayons.red("Try copying everything before the '?variant' \n or before the '?' in the link!".upper())

#While true statment for multiple link checks! 
开发者ID:ajnicolas,项目名称:Shopify-Stock-Checker,代码行数:15,代码来源:shopifychecker.py


注:本文中的crayons.blue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。