本文整理汇总了Python中clint.textui.colored.yellow方法的典型用法代码示例。如果您正苦于以下问题:Python colored.yellow方法的具体用法?Python colored.yellow怎么用?Python colored.yellow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clint.textui.colored
的用法示例。
在下文中一共展示了colored.yellow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: usage
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import yellow [as 别名]
def usage(exit=True, code=1):
print(u"i18n wrapper script for formhub.\n")
with indent(4):
puts(colored.yellow(u",/i18ntool.py add --lang <lang>"))
puts(u"Create required files for enabling translation "
u"of language with code <lang>\n")
puts(colored.yellow(u"./i18ntool.py refresh [--lang <lang>]"))
puts(u"Update the PO file for <lang> based on code.\n"
u"<lang> is optionnal as we only use EN and do "
u"all translations in Transifex.\n")
puts(colored.yellow(u"./i18ntool.py update --user <tx_user> "
u"--password <tx_pass> [--lang <lang>]"))
puts(u"Downloads new PO files for <lang> (or all) from Transifex "
u"then compiles new MO files\n")
puts(colored.yellow(u"./i18ntool.py compile [--lang <lang>]"))
puts(u"Compiles all PO files for <lang> (or all) into MO files.\n"
u"Not required unless you want to.\n")
if exit:
sys.exit(code)
示例2: fix_check
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import yellow [as 别名]
def fix_check(klass, buckets, dry_run, fix_args={}):
for bucket in fetch_buckets(buckets):
check = klass(bucket)
check.perform()
if check.status == 'passed':
message = colored.green('already ' + check.pass_message)
elif check.status == 'denied':
message = colored.red('access denied')
else:
if dry_run:
message = colored.yellow('to be ' + check.pass_message)
else:
try:
check.fix(fix_args)
message = colored.blue('just ' + check.pass_message)
except botocore.exceptions.ClientError as e:
message = colored.red(str(e))
puts(bucket.name + ' ' + message)
示例3: scan_object
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import yellow [as 别名]
def scan_object(bucket_name, key):
obj = s3().Object(bucket_name, key)
str_key = unicode_key(key)
try:
mode = determine_mode(obj.Acl())
if mode == 'private':
puts(str_key + ' ' + colored.green(mode))
else:
puts(str_key + ' ' + colored.yellow(mode))
return mode
except (botocore.exceptions.ClientError, botocore.exceptions.NoCredentialsError) as e:
puts(str_key + ' ' + colored.red(str(e)))
return 'error'
示例4: reset_object
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import yellow [as 别名]
def reset_object(bucket_name, key, dry_run, acl):
obj = s3().Object(bucket_name, key)
str_key = unicode_key(key)
try:
obj_acl = obj.Acl()
mode = determine_mode(obj_acl)
if mode == acl:
puts(str_key + ' ' + colored.green('ACL already ' + acl))
return 'ACL already ' + acl
elif dry_run:
puts(str_key + ' ' + colored.yellow('ACL to be updated to ' + acl))
return 'ACL to be updated to ' + acl
else:
obj_acl.put(ACL=acl)
puts(str_key + ' ' + colored.blue('ACL updated to ' + acl))
return 'ACL updated to ' + acl
except (botocore.exceptions.ClientError, botocore.exceptions.NoCredentialsError) as e:
puts(str_key + ' ' + colored.red(str(e)))
return 'error'
示例5: get_services_urls
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import yellow [as 别名]
def get_services_urls(self):
"""Once started, displays a message with a list of running containers."""
self.init_project()
cts = docker.get_running_containers(self.project_name)[1]
text = ''
for _, ct_info in cts.items():
service_config = self.config['services'][ct_info['compose_name']]
if ({'service_name', 'service_url'} <= set(service_config)) is False:
continue
url = self.get_url(service_config['service_url'], ct_info['compose_name'])
name = colored.yellow(service_config['service_name'])
text += ' - For {}'.format(name).ljust(55, ' ') + ' : ' + url + '\n'
if 'service_extra_ports' in service_config:
ports = ', '.join(map(str, service_config['service_extra_ports']))
text += ' '*4 + '(In your containers use the host '
text += '"{}" and port(s) {})\n'.format(ct_info['compose_name'], ports)
return text
示例6: get_url
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import yellow [as 别名]
def get_url(self, service_url: str, service: str):
"""Build URL to be displayed."""
proxy_conf = self.config['proxy']
# By default our URL is the IP
url = docker.get_ct_item(service, 'ip')
# If proxy enabled, display nice urls
if bool(proxy_conf['enabled']):
http_port = int(proxy_conf['http_port'])
url = docker.get_ct_item(service, 'traefik_host').lower()
url += '' if http_port == 80 else ':{}'.format(http_port)
elif os_name() in ['Windows', 'Darwin']:
puts(colored.yellow('[WARNING]') + ' Under Win and Mac, you need the proxy enabled')
urls = [service_url.format(url) for url in url.split(',')]
return ' / '.join(urls)
示例7: pause
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import yellow [as 别名]
def pause(self, arguments):
"""
Pauses the Mech machine.
Usage: mech pause [options] [<instance>]
Options:
-h, --help Print this help
"""
instance_name = arguments['<instance>']
instance_name = self.activate(instance_name)
vmrun = VMrun(self.vmx, user=self.user, password=self.password)
if vmrun.pause() is None:
puts_err(colored.red("Not paused", vmrun))
else:
puts_err(colored.yellow("Paused", vmrun))
示例8: menu
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import yellow [as 别名]
def menu():
print ""
print colored.yellow("################")
print colored.yellow("##### IPTV #####")
print colored.yellow("##### v" + cr.version + " ###")
print colored.yellow("################")
print ""
print colored.blue("Menu")
print "0 - Exit"
print "1 - Search for some Servers"
print "2 - Look at the servers list"
print "3 - Select language, default is Italian"
print "4 - Brute force all server from the list"
print "5 - Brute force random server from the list"
print "6 - Brute force specific server from the list"
print "7 - Provide a random server to attack"
print ""
示例9: output_cli_result
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import yellow [as 别名]
def output_cli_result(result, compensation=0):
if isinstance(result, bool):
text = colored.green('OK') if result else colored.red('KO')
else:
text = colored.yellow(result)
return '.' * (80 - this.current_position - len(text) - compensation) + text
示例10: output_hint
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import yellow [as 别名]
def output_hint(hint):
print(" " + colored.yellow("Hint: " + hint))
示例11: notice
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import yellow [as 别名]
def notice(message):
puts(colored.yellow(message))
示例12: list_policy
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import yellow [as 别名]
def list_policy(buckets, named=False):
for bucket in fetch_buckets(buckets):
puts(bucket.name)
policy = fetch_policy(bucket)
with indent(2):
if policy is None:
puts(colored.yellow('None'))
else:
if named:
public = public_statement(bucket)
no_object_acl = no_object_acl_statement(bucket)
public_uploads = public_uploads_statement(bucket)
no_uploads = no_uploads_statement(bucket)
encryption = encryption_statement(bucket)
for statement in policy['Statement']:
if statement_matches(statement, public):
named_statement = 'Public'
elif statement_matches(statement, no_object_acl):
named_statement = 'No object ACL'
elif statement_matches(statement, public_uploads):
named_statement = 'Public uploads'
elif statement_matches(statement, no_uploads):
named_statement = 'No uploads'
elif statement_matches(statement, encryption):
named_statement = 'Encryption'
else:
named_statement = 'Custom'
puts(colored.yellow(named_statement))
else:
puts(colored.yellow(json.dumps(policy, indent=4)))
puts()
示例13: update_policy
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import yellow [as 别名]
def update_policy(bucket, encryption=None, dry_run=False):
bucket = s3().Bucket(bucket)
policy = fetch_policy(bucket)
if not policy:
policy = OrderedDict([
('Version', '2012-10-17'),
('Statement', [])
])
es = encryption_statement(bucket)
es_index = next((i for i, s in enumerate(policy['Statement']) if statement_matches(s, es)), -1)
if es_index != -1:
if encryption:
puts("No encryption change")
print_policy(policy)
elif encryption is False:
puts("Removing encryption")
policy['Statement'].pop(es_index)
print_policy(policy)
if not dry_run:
if any(policy['Statement']):
bucket.Policy().put(Policy=json.dumps(policy))
else:
bucket.Policy().delete()
else:
if encryption:
puts("Adding encryption")
policy['Statement'].append(es)
print_policy(policy)
if not dry_run:
bucket.Policy().put(Policy=json.dumps(policy))
elif encryption is False:
puts(colored.yellow("No encryption change"))
print_policy(policy)
示例14: status
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import yellow [as 别名]
def status(self):
"""Return a nice table with the list of started containers."""
self.init_project()
try:
docker.check_cts_are_running(self.project_name)
except SystemError:
puts(colored.yellow('[INFO]') + ' stakkr is currently stopped')
sys.exit(0)
_, cts = docker.get_running_containers(self.project_name)
_print_status_headers()
_print_status_body(cts)
示例15: _is_up
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import yellow [as 别名]
def _is_up(self, container: str):
try:
docker.check_cts_are_running(self.project_name)
except SystemError:
return
if container is None:
puts(colored.yellow('[INFO]') + ' stakkr is already started ...')
sys.exit(0)
# If single container : check if that specific one is running
ct_name = docker.get_ct_item(container, 'name')
if docker.container_running(ct_name):
puts(colored.yellow('[INFO]') + ' service {} is already started ...'.format(container))
sys.exit(0)