本文整理汇总了Python中colorama.Fore.LIGHTGREEN_EX属性的典型用法代码示例。如果您正苦于以下问题:Python Fore.LIGHTGREEN_EX属性的具体用法?Python Fore.LIGHTGREEN_EX怎么用?Python Fore.LIGHTGREEN_EX使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类colorama.Fore
的用法示例。
在下文中一共展示了Fore.LIGHTGREEN_EX属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: chapters
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTGREEN_EX [as 别名]
def chapters(url, course_folder_path):
''' create chapters folder '''
soup = create_soup(url)
heading4 = soup.find_all('h4', {"class": "ga"})
chapter_no = 0
message.colored_message(Fore.LIGHTYELLOW_EX, "Creating Chapters:\n") # Print message
for h in heading4:
chapter = format_chapter(h.text, chapter_no)
chapter_no += 1
message.print_line(chapter)
new_chapter = course_folder_path + "/" + chapter
new_chapter = new_chapter.strip()
os.mkdir(new_chapter) # create folders (chapters)
message.colored_message(Fore.LIGHTGREEN_EX, '\n✅ '+str(chapter_no)+' chapters created!!\n')
示例2: PREPEND
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTGREEN_EX [as 别名]
def PREPEND(state):
"""PREPEND is used to print ==> in front of the lines.
They are colorised according to their status.
If everything is good then green else red.
"""
# State 1 is for ok
# State 2 is for notok
print(Style.BRIGHT, end='')
if state == 1:
print(Fore.LIGHTGREEN_EX, end='')
elif state == 2:
print(Fore.LIGHTRED_EX, end='')
else:
pass
print(' ==> ', end='')
print(Style.RESET_ALL, end='')
示例3: colorize
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTGREEN_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
示例4: pbanner
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTGREEN_EX [as 别名]
def pbanner():
return Style.BRIGHT + Fore.LIGHTGREEN_EX + banner + Style.RESET_ALL
示例5: print_success
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTGREEN_EX [as 别名]
def print_success(*args, **kwargs):
__cprint(Fore.LIGHTGREEN_EX + '[+]' + Fore.RESET, *args, **kwargs)
示例6: main
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTGREEN_EX [as 别名]
def main():
''' Main function '''
init()
message.animate_characters(Fore.LIGHTYELLOW_EX, draw.ROCKET, 0.02)
message.spinning_cursor()
message.print_line('\r1. Paste course url or\n' +
'2. Press enter for Bulk Download')
url = input()
print('')
start_time = time.time() #start time counter begins
if url == "":
# If user press Enter (i.e. url empty), get urls from Bulkdownload.txt
urls = read.bulk_download()
if not urls:
sys.exit(message.colored_message(Fore.LIGHTRED_EX, 'Please paste urls in Bulk Download.txt\n'))
for url in urls:
schedule_download(url)
else:
# begin regular download
schedule_download(url)
try:
end_time = time.time()
message.animate_characters(Fore.LIGHTGREEN_EX, draw.COW, 0.02)
message.colored_message(Fore.LIGHTGREEN_EX, "\nThe whole process took {}\n".format(move.hms_string(end_time - start_time)))
except KeyboardInterrupt:
sys.exit(message.colored_message(Fore.LIGHTRED_EX, "\n- Program Interrupted!!\n"))
示例7: course
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTGREEN_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)
示例8: display_title
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTGREEN_EX [as 别名]
def display_title(self):
print((Fore.LIGHTGREEN_EX + "Webpage: " + Fore.RESET) + (Fore.WHITE + self.soup.title.string + Fore.RESET))
print("\n")
示例9: display_header
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTGREEN_EX [as 别名]
def display_header(self):
print(Fore.LIGHTGREEN_EX + "HEADER TAGS: " + Fore.RESET + "\n")
titles = self.soup.find_all(['h1' , 'h2', 'h3' , 'h4' , 'h5' , 'h6'])
for i in titles:
print(i)
print("\n")
示例10: display_links
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTGREEN_EX [as 别名]
def display_links(self):
links = self.soup.find_all("a")
print(Fore.LIGHTGREEN_EX + "LINKS: " + Fore.RESET + "\n")
for ind, val in enumerate(links):
print((Fore.CYAN + val.text + "_link{ind+1}: " + Fore.RESET) + val.attrs["href"])
示例11: compare
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTGREEN_EX [as 别名]
def compare(path=None, *fields, **kwfields):
store = {}
getters = Getters(fields, kwfields)
def _compare(old, new):
if isinstance(old, dict):
return {k: _compare(v, new[k]) for k, v in old.items()}
elif isinstance(old, (int, float)):
diff = new - old
if diff == 0:
return old
c = Fore.LIGHTGREEN_EX if diff > 0 else Fore.LIGHTRED_EX
diff = f"+{diff}" if diff > 0 else str(diff)
return f"{old} -> {new} ({_color(c, diff)})"
elif hasattr(old, "compare"):
return old.compare(new)
elif old == new:
return old
else:
return f"{old} -> {new}"
def _enter(_curpath, **kwargs):
_path = _curpath[:-6]
w = breakword.word()
store[_path] = (w, getters(kwargs))
_brk(w)
def _exit(_curpath, **kwargs):
if "success" in kwargs and not kwargs["success"]:
return
_path = _curpath[:-5]
w, old = store[_path]
new = getters(kwargs)
_display(_path, _compare(old, new), word=w, brk=False)
path = _resolve_path(path, variant="cmp")
return DoTrace({f"{path}/enter": _enter, f"{path}/exit": _exit})
示例12: url_supported_list
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTGREEN_EX [as 别名]
def url_supported_list():
print('Supported sources:')
for url in sorted(crawler_list.keys()):
print(Fore.LIGHTGREEN_EX, Icons.RIGHT_ARROW, url, Fore.RESET)
# end for
# end def
示例13: print_help
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTGREEN_EX [as 别名]
def print_help():
terminal(CMD_CLEAR_TERM)
print(Fore.LIGHTGREEN_EX + 'PROX v0.2 - Utility for checking proxy in terminal')
print(Fore.LIGHTGREEN_EX + 'Authors: Hasanov Abdurahmon & Ilyosiddin Kalandar')
print(Fore.LIGHTCYAN_EX)
print('Usage -> prox -f <filename> - Check file with proxies')
print('prox -p <proxy> - check only one proxy')
print('prox --help - show this menu')
示例14: success
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTGREEN_EX [as 别名]
def success(line):
print(Fore.LIGHTGREEN_EX + line + Style.RESET_ALL)
示例15: disass_instruction
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTGREEN_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)