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


Python crayons.yellow方法代码示例

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


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

示例1: _cstate

# 需要导入模块: import crayons [as 别名]
# 或者: from crayons import yellow [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: format_path

# 需要导入模块: import crayons [as 别名]
# 或者: from crayons import yellow [as 别名]
def format_path(path):
    """
    Format the cycle with colors
    :param path:
    :return: str
    """
    if 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 '' 
开发者ID:bndr,项目名称:pycycle,代码行数:24,代码来源:utils.py

示例3: start

# 需要导入模块: import crayons [as 别名]
# 或者: from crayons import yellow [as 别名]
def start(self):
        print("")
        print("{} {}".format(crayons.yellow("Pulling image"),
                             crayons.red(self.image)))
        with blindspin.spinner():
            docker_client = self.get_docker_client()
            self._container = docker_client.run(self.image,
                                                command=self._command,
                                                detach=True,
                                                environment=self.env,
                                                ports=self.ports,
                                                name=self._name,
                                                volumes=self.volumes,
                                                **self._kargs
                                                )
        print("")
        print("Container started: ",
              crayons.yellow(self._container.short_id, bold=True))
        return self 
开发者ID:testcontainers,项目名称:testcontainers-python,代码行数:21,代码来源:container.py

示例4: ping_test_ok

# 需要导入模块: import crayons [as 别名]
# 或者: from crayons import yellow [as 别名]
def ping_test_ok(self):
        addr = self.props.ip
        if os.name == "nt":
            ping = [r'C:\WINDOWS\system32\ping.exe', '-n', '1', '-w', '5', addr]
        else:
            ping = ['ping', '-c', '1', '-W', '5', addr]
        p = subprocess.Popen(ping, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False)
        p.communicate()
        if p.returncode != 0:
            self.log(crayons.yellow(f'Host at address {addr} cannot be reached - skipped'))
            return False
        return True 
开发者ID:mlsmithjr,项目名称:transcoder,代码行数:14,代码来源:cluster.py

示例5: match_profile

# 需要导入模块: import crayons [as 别名]
# 或者: from crayons import yellow [as 别名]
def match_profile(self, job: EncodeJob, name: str) -> Optional[Profile]:
        if job.profile_name is None:
            rule = self.configfile.match_rule(job.media_info, restrict_profiles=self.props.profiles)
            if rule is None:
                self.log(crayons.yellow(
                    f'Failed to match rule/profile for host {name} for file {job.inpath} - skipped'))
                return None
            job.profile_name = rule.profile
        return self._manager.profiles[job.profile_name] 
开发者ID:mlsmithjr,项目名称:transcoder,代码行数:11,代码来源:cluster.py

示例6: cli

# 需要导入模块: import crayons [as 别名]
# 或者: from crayons import yellow [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

示例7: forward

# 需要导入模块: import crayons [as 别名]
# 或者: from crayons import yellow [as 别名]
def forward(self, x):
        print(crayons.yellow(self.name))
        print(crayons.yellow('----'))
        print('Shape {}'.format(x.shape))
        if x.ndim == 4:
            print("Stats mean {:.2f} {:.2f} var s{:.2f} {:.2f}".format(
                x.mean(dim=[0, 2, 3]).mean().item(),
                x.mean().item(),
                x.std(dim=[0, 2, 3]).mean().item(),
                x.std().item()))
        print()
        return x 
开发者ID:Vermeille,项目名称:Torchelie,代码行数:14,代码来源:debug.py

示例8: formattext

# 需要导入模块: import crayons [as 别名]
# 或者: from crayons import yellow [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

示例9: wait_container_is_ready

# 需要导入模块: import crayons [as 别名]
# 或者: from crayons import yellow [as 别名]
def wait_container_is_ready():
    """
    Wait until container is ready.
    Function that spawn container should be decorated by this method
    Max wait is configured by config. Default is 120 sec.
    Polling interval is 1 sec.
    :return:
    """

    @wrapt.decorator
    def wrapper(wrapped, instance, args, kwargs):
        exception = None
        print(crayons.yellow("Waiting to be ready..."))
        with blindspin.spinner():
            for _ in range(0, config.MAX_TRIES):
                try:
                    return wrapped(*args, **kwargs)
                except Exception as e:
                    time.sleep(config.SLEEP_TIME)
                    exception = e
            raise TimeoutException(
                """Wait time exceeded {0} sec.
                    Method {1}, args {2} , kwargs {3}.
                     Exception {4}""".format(config.MAX_TRIES,
                                             wrapped.__name__,
                                             args, kwargs, exception))

    return wrapper 
开发者ID:testcontainers,项目名称:testcontainers-python,代码行数:30,代码来源:waiting_utils.py

示例10: serve

# 需要导入模块: import crayons [as 别名]
# 或者: from crayons import yellow [as 别名]
def serve(self, workers=None, **kwargs):
        """Serves the Flask application."""
        if self.app.debug:
            print(crayons.yellow('Booting Flask development server...'))
            self.app.run()

        else:
            print(crayons.yellow('Booting Gunicorn...'))

            # Start the web server.
            server = GunicornServer(
                self.app, workers=workers or number_of_gunicorn_workers(),
                worker_class='egg:meinheld#gunicorn_worker', **kwargs)
            server.run() 
开发者ID:schedutron,项目名称:flask-common,代码行数:16,代码来源:flask_common.py

示例11: enqueue

# 需要导入模块: import crayons [as 别名]
# 或者: from crayons import yellow [as 别名]
def enqueue(self, file, forced_profile: Optional[str]) -> (str, Optional[EncodeJob]):
        """Add a media file to this cluster queue.
           This is different than in local mode in that we only care about handling skips here.
           The profile will be selected once a host is assigned to the work
        """

        path = os.path.abspath(file)  # convert to full path so that rule filtering can work
        if pytranscoder.verbose:
            print('matching ' + path)

        media_info = self.ffmpeg.fetch_details(path)
        if media_info is None:
            print(crayons.red(f'File not found: {path}'))
            return None, None
        if media_info.valid:

            if pytranscoder.verbose:
                print(str(media_info))

            if forced_profile is None:
                #
                # just interested in SKIP rule matches and queue designations here
                #

                profile = None
                rule = self.config.match_rule(media_info)
                if rule is None:
                    print(crayons.yellow(f'No matching profile found - skipped'))
                    return None, None
                if rule.is_skip():
                    basename = os.path.basename(path)
                    print(f'{basename}: Skipping due to profile rule - {rule.name}')
                    return None, None
                profile = self.profiles[rule.profile]
            else:
                profile = self.profiles[forced_profile]

            if pytranscoder.verbose:
                print("Matched to profile {profile.name}")

            # not short circuited by a skip rule, add to appropriate queue
            queue_name = profile.queue_name if profile.queue_name is not None else '_default'
            if queue_name not in self.queues:
                print(crayons.red('Error: ') +
                      f'Queue "{queue_name}" referenced in profile "{profile.name}" not defined in any host')
                exit(1)
            job = EncodeJob(file, media_info, profile.name)
            self.queues[queue_name].put(job)
            return queue_name, job
        return None, None 
开发者ID:mlsmithjr,项目名称:transcoder,代码行数:52,代码来源:cluster.py


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