本文整理汇总了Python中colorama.Fore.LIGHTBLACK_EX属性的典型用法代码示例。如果您正苦于以下问题:Python Fore.LIGHTBLACK_EX属性的具体用法?Python Fore.LIGHTBLACK_EX怎么用?Python Fore.LIGHTBLACK_EX使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类colorama.Fore
的用法示例。
在下文中一共展示了Fore.LIGHTBLACK_EX属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __call__
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLACK_EX [as 别名]
def __call__(self, jarvis, s):
"""Run the geocoding tool by getting an address from the user, passing
it to the geocoding API, and displaying the result.
Parameters
----------
jarvis : CmdInterpreter.JarvisAPI
An instance of Jarvis that will be used to interact with the user
s : str
The input string that was submitted when the plugin was launched.
Likely to be empty.
"""
self.jarvis = jarvis
# Required disclaimer per API terms of service
self.jarvis.say("Disclaimer: This product uses the Census Bureau Data"
" API but is not endorsed or certified by the Census"
" Bureau.", Fore.LIGHTBLACK_EX)
self.input_addr = self.get_input_addr(s)
self.cleaned_addr = self.clean_addr(self.input_addr)
self.response = self.get_response()
# Request failed
if not self.response:
self.jarvis.say("The geocoding service appears to be unavailable."
" Please try again later.", Fore.RED)
# Request succeeded
else:
self.output = self.parse_response(self.response)
if self.output:
for result in self.output:
self.jarvis.say("{}: {}".format(result,
self.output[result]),
Fore.CYAN)
else:
self.jarvis.say("No matching addresses found.", Fore.RED)
示例2: print_gray
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLACK_EX [as 别名]
def print_gray(*args):
""""""
raw = str(args)
init(autoreset=True)
print((Fore.LIGHTBLACK_EX + raw))
#----------------------------------------------------------------------
示例3: result_collector
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLACK_EX [as 别名]
def result_collector(result_queue):
"""Collect and display results."""
def notename(n, space):
if space:
return [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
' '][n % 12]
return [
Fore.BLUE + 'A' + Style.RESET_ALL,
Fore.LIGHTBLUE_EX + 'A#' + Style.RESET_ALL,
Fore.GREEN + 'B' + Style.RESET_ALL,
Fore.CYAN + 'C' + Style.RESET_ALL,
Fore.LIGHTCYAN_EX + 'C#' + Style.RESET_ALL,
Fore.RED + 'D' + Style.RESET_ALL,
Fore.LIGHTRED_EX + 'D#' + Style.RESET_ALL,
Fore.YELLOW + 'E' + Style.RESET_ALL,
Fore.WHITE + 'F' + Style.RESET_ALL,
Fore.LIGHTBLACK_EX + 'F#' + Style.RESET_ALL,
Fore.MAGENTA + 'G' + Style.RESET_ALL,
Fore.LIGHTMAGENTA_EX + 'G#' + Style.RESET_ALL,
][n % 12] #+ str(n//12)
print('Listening to results..')
# TODO(mtyka) Ensure serial stitching of results (no guarantee that
# the blocks come in in order but they are all timestamped)
while True:
result = result_queue.get()
serial = result.audio_chunk.serial
result_roll = result.result
if serial > 0:
result_roll = result_roll[4:]
for notes in result_roll:
for i in range(6, len(notes) - 6):
note = notes[i]
is_frame = note[0] > 0.0
notestr = notename(i, not is_frame)
print(notestr, end='')
print('|')
示例4: prepare_inputs
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLACK_EX [as 别名]
def prepare_inputs(context, tokenizer):
'''context
context: I love you. [SEP] Sorry, I hate you.
'''
tokens = tokenizer.tokenize(context)
tokens = tokenizer.convert_tokens_to_ids(tokens)[-hp.max_span+2:]
tokens = [101] + tokens + [102]
# print(f"{Fore.LIGHTBLACK_EX}context:{tokenizer.convert_ids_to_tokens(tokens)}{Style.RESET_ALL}")
tokens = torch.LongTensor(tokens)
tokens = tokens.unsqueeze(0) # (1, T)
tokens = tokens.to("cuda")
return tokens
示例5: _display
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLACK_EX [as 别名]
def _display(curpath, results, word=None, brk=True):
w = word or breakword.word()
if len(results) == 0:
print(w, curpath)
elif len(results) == 1:
_, value = list(results.items())[0]
print(w, _color(Fore.LIGHTBLACK_EX, curpath), value)
else:
print(w, _color(Fore.LIGHTBLACK_EX, curpath))
for name, value in results.items():
print(f" {name}: {value}")
if brk:
_brk(w)
示例6: main
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLACK_EX [as 别名]
def main():
init()
log(f'Starting {Fore.MAGENTA}{Style.DIM}PyNubank{Style.NORMAL}{Fore.LIGHTBLUE_EX} context creation.')
device_id = generate_random_id()
log(f'Generated random id: {device_id}')
cpf = input(f'[>] Enter your CPF(Numbers only): ')
password = getpass('[>] Enter your password (Used on the app/website): ')
generator = CertificateGenerator(cpf, password, device_id)
log('Requesting e-mail code')
try:
email = generator.request_code()
except NuException:
log(f'{Fore.RED}Failed to request code. Check your credentials!', Fore.RED)
return
log(f'Email sent to {Fore.LIGHTBLACK_EX}{email}{Fore.LIGHTBLUE_EX}')
code = input('[>] Type the code received by email: ')
cert1, cert2 = generator.exchange_certs(code)
save_cert(cert1, 'cert.p12')
print(f'{Fore.GREEN}Certificates generated successfully. (cert.pem)')
print(f'{Fore.YELLOW}Warning, keep these certificates safe (Do not share or version in git)')
示例7: header
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLACK_EX [as 别名]
def header(line):
print(Fore.LIGHTBLACK_EX + line + Style.RESET_ALL)
示例8: lightblack
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLACK_EX [as 别名]
def lightblack(s: str) -> str:
return f"{Fore.LIGHTBLACK_EX}{s}{Style.RESET_ALL}"