本文整理汇总了Python中colorama.Fore.LIGHTBLUE_EX属性的典型用法代码示例。如果您正苦于以下问题:Python Fore.LIGHTBLUE_EX属性的具体用法?Python Fore.LIGHTBLUE_EX怎么用?Python Fore.LIGHTBLUE_EX使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类colorama.Fore
的用法示例。
在下文中一共展示了Fore.LIGHTBLUE_EX属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: colorize
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLUE_EX [as 别名]
def colorize(self, msg):
"""
Mewarnai pesan
"""
color = self.color_map[self.record.levelno]
reset = Style.RESET_ALL
levelname = reset + color + self.record.levelname + reset
if self.record.levelname == "CRITICAL":
color = self.color_map[logging.ERROR]
name = Fore.LIGHTBLUE_EX + self.record.name + reset
message = self.record.message
# XXX: kenapa cara dibawah ini tidak bekerja?
#
# match = re.findall(r"['\"]+(.*?)['\"]+", message)
# if match:
# match.reverse()
# for m in match:
# message = message.replace(m, color + m + reset, 1)
match = re.search(r"=> (?P<account>.*?(?:| \: .*?)) \((?P<status>[A-Z]+)\)", message)
if match:
account = match.group("account")
status = match.group("status")
if status == "NO":
color_status = Fore.LIGHTRED_EX
else:
color_status = Fore.LIGHTGREEN_EX
newmsg = message.replace(account, color_status + account + reset)
newmsg = newmsg.replace(status, color_status + status + reset)
msg = msg.replace(message, newmsg)
asctime = re.findall(r"\[(.+?)\]", msg)[0]
msg = msg.replace(asctime, Fore.LIGHTMAGENTA_EX + asctime + reset, 1)
msg = msg.replace(self.record.name, name, 1)
msg = msg.replace(self.record.levelname, levelname, 1)
msg = msg + reset
return msg
示例2: source_path
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLUE_EX [as 别名]
def source_path(self, jarvis, dir_name):
all_paths = []
# Changing static path to get the home path from PATH variables.
# The '/home' was causing script to exit with "file not found" error
# on Darwin.
home_dir = os.environ.get("HOME")
user_name = os.environ.get("USER")
home_path = home_dir.split(user_name)[0].rstrip('/')
for root in os.walk(home_path):
print(
Fore.LIGHTBLUE_EX
+ "Searching in {}...".format(
(root[0])[
:70]),
end="\r")
sys.stdout.flush()
if dir_name == root[0].split('/')[-1]:
all_paths.append(root[0])
for i, path_info in enumerate(all_paths):
print()
print("{}. {}".format(i + 1, path_info))
if len(all_paths) == 0:
print(Fore.LIGHTRED_EX + 'No directory found')
exit()
choice = int(jarvis.input('\nEnter the option number: '))
if choice < 1 or choice > len(all_paths):
path = ''
print(Fore.LIGHTRED_EX + 'Wrong choice entered')
exit()
else:
path = all_paths[choice - 1]
return path
示例3: print_before
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLUE_EX [as 别名]
def print_before(self, path):
print("Cleaning {} located at {}\n".format(path.split('/')[-1], path))
print(Fore.LIGHTBLUE_EX + "Folders before cleaning\n" + Fore.RESET)
for files in os.listdir(path):
print(files, end='\t')
print()
示例4: print_after
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLUE_EX [as 别名]
def print_after(self, path):
print(Fore.LIGHTBLUE_EX + "\nFolders after cleaning\n" + Fore.RESET)
for files in os.listdir(path):
print(files, sep=',\t')
print(Fore.LIGHTMAGENTA_EX + "\nCLEANED\n" + Fore.RESET)
示例5: print_before
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLUE_EX [as 别名]
def print_before(path):
print("Cleaning {} located at {}\n".format(path.split('/')[-1],path))
print(Fore.LIGHTBLUE_EX + "Before cleaning\n" + Fore.RESET)
for files in os.listdir(path):
print(files,end='\t')
print()
示例6: print_after
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLUE_EX [as 别名]
def print_after(path):
print(Fore.LIGHTBLUE_EX + "\nAfter cleaning\n" + Fore.RESET)
for files in os.listdir(path):
print(files,end='\t')
print(Fore.LIGHTMAGENTA_EX + "\n\nCLEANED\n" + Fore.RESET)
示例7: __parse_prompt
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLUE_EX [as 别名]
def __parse_prompt(self):
raw_prompt_default_template = Style.BRIGHT + Fore.BLUE + "{host}" + Fore.RESET + " > " + Style.NORMAL
raw_prompt_template = os.getenv("ISAF_RAW_PROMPT", raw_prompt_default_template).replace('\\033', '\033')
self.raw_prompt_template = raw_prompt_template if '{host}' in raw_prompt_template else raw_prompt_default_template
module_prompt_default_template = Style.BRIGHT + Fore.BLUE + "{host}" + Fore.RESET + " (" + Fore.LIGHTBLUE_EX \
+ "{module}" + Fore.RESET + Style.NORMAL + ") > "
module_prompt_template = os.getenv("ISAF_MODULE_PROMPT", module_prompt_default_template).replace('\\033',
'\033')
self.module_prompt_template = module_prompt_template if all(
map(lambda x: x in module_prompt_template, ['{host}', "{module}"])) else module_prompt_default_template
示例8: print_status
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLUE_EX [as 别名]
def print_status(*args, **kwargs):
__cprint(Fore.LIGHTBLUE_EX + '[*]' + Fore.RESET, *args, **kwargs)
示例9: course
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLUE_EX [as 别名]
def course(url, lynda_folder_path):
''' create course folder '''
current_course = course_path(url, lynda_folder_path)
courses = os.listdir(lynda_folder_path)
answer = None
for course in courses:
if (lynda_folder_path + course) == current_course:
if read.redownload_course == 'force':
# delete existing course and re-download
shutil.rmtree(current_course)
message.colored_message(Fore.LIGHTRED_EX, "\n✅ Course folder already exists. Current preference -> FORCE redownload")
message.colored_message(Fore.LIGHTRED_EX, "\n❌ Existing course folder deleted!!")
time.sleep(2)
message.colored_message(Fore.LIGHTGREEN_EX, "\n♻️ Re-downloading the course.\n")
time.sleep(2)
elif read.redownload_course == 'skip':
# skip download process
message.colored_message(Fore.LIGHTRED_EX, "\n✅ Course folder already exists. Current preference -> SKIP redownload")
sys.exit(message.colored_message(Fore.LIGHTRED_EX, "\n-> Skipping course download.\n"))
elif read.redownload_course == 'prompt':
# prompt user with available choices
QUESTION = '\n✅ Course folder already exists: Do you wish to delete it and download again? (Y/N): '
sys.stdout.write(Fore.LIGHTBLUE_EX + QUESTION + Fore.RESET)
while answer != 'y':
# get user input
answer = input().lower()
if answer == 'y':
shutil.rmtree(current_course)
message.colored_message(Fore.LIGHTRED_EX, "\n❌ Existing course folder deleted!!")
time.sleep(2)
message.colored_message(Fore.LIGHTGREEN_EX, "\n♻️ Re-downloading the course.\n")
elif answer == 'n':
sys.exit(message.colored_message(Fore.LIGHTRED_EX, "\n-> Program Ended!!\n"))
else:
sys.stdout.write(Fore.LIGHTRED_EX + "\n- oops!! that's not a valid choice, type Y or N: " + Fore.RESET)
print(f'\ncreating course folder at: {current_course}')
os.mkdir(current_course)
示例10: result_collector
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLUE_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('|')
示例11: log
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLUE_EX [as 别名]
def log(message, color=Fore.BLUE):
print(f'{color}{Style.DIM}[*] {Style.NORMAL}{Fore.LIGHTBLUE_EX}{message}')
示例12: main
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLUE_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)')
示例13: disass_instruction
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLUE_EX [as 别名]
def disass_instruction(uc, instr, addr_alias="", columns=False):
if instr.id == 0:
pass
(regs_read, regs_write) = instr.regs_access()
reg_values = {}
for r in regs_read:
uc_constant = getattr(unicorn.x86_const, f"UC_X86_REG_{instr.reg_name(r).upper()}", None)
if uc_constant:
reg_values[instr.reg_name(r)] = uc.reg_read(uc_constant)
reg_values_str = ' '.join([f"{name}=0x{value:02x}" for name, value in reg_values.items()])
if X86_GRP_JUMP in instr.groups:
if jump_taken(uc, instr):
color = Fore.LIGHTGREEN_EX
comment = f"; taken! {reg_values_str}"
else:
color = Fore.LIGHTRED_EX
comment = f"; not taken! {reg_values_str}"
else:
color = Fore.RESET
comment = f"; {reg_values_str}" if reg_values_str else ""
mnemonic = f"{color}{instr.mnemonic}{Fore.RESET}"
addr_alias = f"0x{instr.address:02x}, {Fore.LIGHTRED_EX}{addr_alias}{Fore.RESET}" if addr_alias \
else f"0x{instr.address:02x}"
disass_cols = f">>> {addr_alias}:", f"{mnemonic} {Fore.LIGHTCYAN_EX}{instr.op_str}{Fore.RESET}", f"{Fore.LIGHTBLUE_EX}{comment}{Fore.RESET}"
if columns:
return disass_cols
return " ".join(disass_cols)
示例14: get_path_from_user
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLUE_EX [as 别名]
def get_path_from_user(self, known_samples):
print("Your options for today:\n")
lines = []
for i, s in enumerate(known_samples):
if s == "New sample...":
lines += [(f"\t[{i}]", f"{Fore.LIGHTYELLOW_EX}New sample...{Fore.RESET}", "")]
else:
label, name = s.split(";")
lines += [(f"\t[{i}]", f"{Fore.LIGHTBLUE_EX}{label}:{Fore.RESET}", name)]
print_cols(lines)
print()
while True:
try:
id = int(input("Enter the option ID: "))
except ValueError:
print("Error parsing ID")
continue
if 0 <= id < len(known_samples) - 1:
path = known_samples[id].split(";")[1]
elif id == len(known_samples) - 1:
path = input("Please enter the sample path (single file or directory): ").rstrip()
else:
print(f"Invalid ID. Allowed range: 0 - {len(known_samples) - 1}")
continue
if os.path.exists(path):
return path
else:
print("Path does not exist")
continue
示例15: now_time
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTBLUE_EX [as 别名]
def now_time():
return f'{Fore.LIGHTBLUE_EX}{strftime("%H:%M:%S ", lt())}'