當前位置: 首頁>>代碼示例>>Python>>正文


Python crayons.green方法代碼示例

本文整理匯總了Python中crayons.green方法的典型用法代碼示例。如果您正苦於以下問題:Python crayons.green方法的具體用法?Python crayons.green怎麽用?Python crayons.green使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在crayons的用法示例。


在下文中一共展示了crayons.green方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _cstate

# 需要導入模塊: import crayons [as 別名]
# 或者: from crayons import green [as 別名]
def _cstate(tw):
        """Returns state in colour for pretty printing reports."""
        if isinstance(tw, ThreadWrapper):
            if tw.state == ThreadState.SUCCESS:
                return str(crayons.green(tw.state.name))
            elif tw.state == ThreadState.FAILED:
                return str(crayons.red(tw.state.name))
            else:
                return str(crayons.yellow(tw.state.name))
        else:
            if ThreadState.SUCCESS.name in tw:
                return str(crayons.green(tw))
            elif ThreadState.FAILED.name in tw:
                return str(crayons.red(tw))
            else:
                return str(crayons.yellow(tw)) 
開發者ID:csurfer,項目名稱:pypette,代碼行數:18,代碼來源:pipes.py

示例2: report

# 需要導入模塊: import crayons [as 別名]
# 或者: from crayons import green [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

示例3: _pretty_print

# 需要導入模塊: import crayons [as 別名]
# 或者: from crayons import green [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

示例4: cli

# 需要導入模塊: import crayons [as 別名]
# 或者: from crayons import green [as 別名]
def cli(ctx, verbose=False, help=False, source=None, here=False, ignore='', encoding=None):
    if ctx.invoked_subcommand is None:

        if source:
            source = os.path.abspath(source)
            click.echo(crayons.yellow(
                'Target source provided: {}'.format(source)))
        elif here:
            source = os.getcwd()
        else:
            # Display help to user, if no commands were passed.
            click.echo(format_help(ctx.get_help()))
            sys.exit(0)

        if not source:
            click.echo(crayons.red(
                'No project provided. Provide either --here or --source.'))

        if not os.path.isdir(source):
            click.echo(crayons.red('Directory does not exist.'), err=True)
            sys.exit(1)

        root_node = read_project(source, verbose=verbose, ignore=ignore.split(','), encoding=encoding)

        click.echo(crayons.yellow(
            'Project successfully transformed to AST, checking imports for cycles..'))

        if check_if_cycles_exist(root_node):
            click.echo(crayons.red('Cycle Found :('))
            click.echo(crayons.red(get_cycle_path(root_node)))
            click.echo(crayons.green("Finished."))
            sys.exit(1)
        else:
            click.echo(crayons.green(('No worries, no cycles here!')))
            click.echo(crayons.green(
                'If you think some cycle was missed, please open an Issue on Github.'))
            click.echo(crayons.green("Finished."))
            sys.exit(0) 
開發者ID:bndr,項目名稱:pycycle,代碼行數:40,代碼來源:cli.py

示例5: colordiff

# 需要導入模塊: import crayons [as 別名]
# 或者: from crayons import green [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

示例6: formattext

# 需要導入模塊: import crayons [as 別名]
# 或者: from crayons import green [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.green方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。