本文整理汇总了Python中colorama.Fore.MAGENTA属性的典型用法代码示例。如果您正苦于以下问题:Python Fore.MAGENTA属性的具体用法?Python Fore.MAGENTA怎么用?Python Fore.MAGENTA使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类colorama.Fore
的用法示例。
在下文中一共展示了Fore.MAGENTA属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: format
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def format(self, record):
# add color
if self.colors and record.levelname in COLORS:
start = COLORS[record.levelname]
record.levelname = start + record.levelname + Fore.RESET
record.msg = Fore.WHITE + record.msg + Fore.RESET
# add extras
if self.extras:
extras = merge_record_extra(record=record, target=dict(), reserved=RESERVED_ATTRS)
record.extras = ', '.join('{}={}'.format(k, v) for k, v in extras.items())
if record.extras:
record.extras = Fore.MAGENTA + '({})'.format(record.extras) + Fore.RESET
# hide traceback
if not self.traceback:
record.exc_text = None
record.exc_info = None
record.stack_info = None
return super().format(record)
示例2: first_time_init
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def first_time_init(self, jarvis):
remind_still_active = []
for item in self.get_data(jarvis):
timestamp = item['timestamp']
if timestamp < time.time():
time_format = self.timestamp_to_string(timestamp)
jarvis.say(
"Reminder: {} missed ({})".format(
item['message'], time_format), Fore.MAGENTA)
continue
schedule_id = jarvis.schedule(timestamp, self.reminder_exec,
item['message'])
item['schedule_id'] = schedule_id
remind_still_active += [item]
self.save_data(jarvis, remind_still_active)
示例3: magenta
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def magenta(s: str) -> str: # pragma: no cover
"""Magenta color string if tty
Args:
s (str): String to color
Returns:
str: Colored string
Examples:
>>> from chepy.modules.internal.colors import magenta
>>> print(MAGENTA("some string"))
"""
if sys.stdout.isatty():
return Fore.MAGENTA + s + Fore.RESET
else:
return s
示例4: preprocess
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def preprocess(self):
response = namedtuple('response', 'color label intl title')
self.responses = {
'pass': response(color=Fore.GREEN, label="PASS", intl='P', title="Passed : "),
'rule': response(color=Fore.RED, label="FAIL", intl='F', title="Failed : "),
'info': response(color=Fore.WHITE, label="INFO", intl='I', title="Info : "),
'skip': response(color=Fore.BLUE, label="SKIP", intl='S', title="Missing Deps: "),
'fingerprint': response(color=Fore.YELLOW, label="FINGERPRINT", intl='P',
title="Fingerprint : "),
'metadata': response(color=Fore.YELLOW, label="META", intl='M', title="Metadata : "),
'metadata_key': response(color=Fore.MAGENTA, label="META", intl='K', title="Metadata Key: "),
'exception': response(color=Fore.RED, label="EXCEPT", intl='E', title="Exceptions : ")
}
self.counts = {}
for key in self.responses:
self.counts[key] = 0
self.print_header("Progress:", Fore.CYAN)
self.broker.add_observer(self.progress_bar, rule)
self.broker.add_observer(self.progress_bar, condition)
self.broker.add_observer(self.progress_bar, incident)
self.broker.add_observer(self.progress_bar, parser)
示例5: banner
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def banner():
print(
Style.BRIGHT
+ Color.MAGENTA
+ """
_/_/_/ _/ _/ _/
_/ _/_/ _/_/_/ _/ _/_/ _/_/_/ _/_/_/ _/ _/
_/_/ _/_/_/_/ _/ _/ _/_/ _/ _/ _/ _/_/_/_/
_/ _/ _/ _/ _/ _/ _/ _/ _/
_/_/_/ _/_/_/ _/_/_/ _/ _/_/_/ _/ _/ _/
> version 1.0
> Script to find user account on various platforms.
"""
+ Style.RESET_ALL
)
示例6: color
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def color(s, c, style="bright"):
color_map = {
"black": Fore.BLACK,
"red": Fore.RED,
"green": Fore.GREEN,
"yellow": Fore.YELLOW,
"blue": Fore.BLUE,
"magenta": Fore.MAGENTA,
"cyan": Fore.CYAN,
"white": Fore.WHITE,
}
style_map = {
"dim": Style.DIM,
"normal": Style.NORMAL,
"bright": Style.BRIGHT,
}
return color_map[c] + style_map[style] + s + Style.RESET_ALL
示例7: main
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def main(SONG_NAME=''):
"""Run on program call."""
cache = Cache()
match = cache.search(SONG_NAME)
if match:
PREPEND(1)
print(Fore.MAGENTA, end='')
print('{} '.format(SONG_NAME), end='')
print(Style.RESET_ALL, end='')
print('found.')
while True:
choice = input('Do you still want to continue[y/n]')
choice = choice.lower()
if choice == 'y' or choice == 'Y':
return True
elif choice == 'n' or choice == 'N':
return False
else:
return True
示例8: main
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def main(self, s):
# Trims input s to be just the city/region name
s = s.replace('time ', '').replace('in ', '')
exists = os.path.isfile(module_path + 'key_timein.json')
if not exists:
shutil.copy2(
module_path
+ 'samplekey_timein.json',
module_path
+ 'key_timein.json')
print(
Fore.RED
+ "Generate api key here: https://developers.google.com/maps/documentation/geocoding/start?hl=en_US")
print(
Fore.RED
+ "and add it to jarviscli/data/key_timein.json"
+ Fore.RESET)
return
# Transforms a city name into coordinates using Google Maps API
loc = getLocation(s)
if loc is None:
return
# Gets current date and time using TimeZoneDB API
send_url = (
"http://api.timezonedb.com/v2/get-time-zone?"
"key=BFA6XBCZ8AL5&format=json"
"&by=position&lat={:.6f}&lng={:.6f}".format(*loc)
)
r = requests.get(send_url)
j = json.loads(r.text)
time = j['formatted']
self.dst = j['dst']
# Prints current date and time as YYYY-MM-DD HH:MM:SS
print("{COLOR}The current date and time in {LOC} is: {TIME}{COLOR_RESET}"
.format(COLOR=Fore.MAGENTA, COLOR_RESET=Fore.RESET,
LOC=str(s).title(), TIME=str(time)))
示例9: remind_add
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def remind_add(self, jarvis, s, time_in_parser, example):
s = s.split(" to ")
if len(s) != 2:
jarvis.say("Sorry, please say something like:", Fore.MAGENTA)
jarvis.say(" > {}".format(example), Fore.MAGENTA)
return
time_in = time_in_parser(s[0])
while time_in is None:
jarvis.say("Sorry, when should I remind you?", Fore.MAGENTA)
time_in = time_in_parser(jarvis.input("Time: "))
timestamp = time.time() + time_in
message = s[1]
notification_message = message
todo_refere_id = None
if message == 'todo':
message = ''
todo_refere_entry = self.interact().select_one_remind(jarvis)
if todo_refere_entry is None:
jarvis.say("Nothing selected", Fore.MAGENTA)
return
notification_message = todo_refere_entry['message']
notification_message = "TODO: {}".format(notification_message)
todo_refere_id = todo_refere_entry['id']
# schedule
schedule_id = jarvis.schedule(time_in, self.reminder_exec,
notification_message)
self.add(jarvis, message, timestamp=timestamp, schedule_id=schedule_id,
todo_refere_id=todo_refere_id)
示例10: bright_foreground
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def bright_foreground(self):
color = {
'red' : '{0}{1}'.format(Fore.RED, Style.BRIGHT),
'cyan' : '{0}{1}'.format(Fore.CYAN, Style.BRIGHT),
'green' : '{0}{1}'.format(Fore.GREEN, Style.BRIGHT),
'yellow' : '{0}{1}'.format(Fore.YELLOW, Style.BRIGHT),
'blue' : '{0}{1}'.format(Fore.BLUE, Style.BRIGHT),
'magenta' : '{0}{1}'.format(Fore.MAGENTA, Style.BRIGHT),
'white' : '{0}{1}'.format(Fore.WHITE, Style.BRIGHT),
'grey' : '{0}{1}'.format(Fore.WHITE, Style.RESET_ALL)
}
return color
示例11: print_purpul
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def print_purpul(*args):
""""""
raw = str(args)
init(autoreset=True)
print((Fore.MAGENTA + raw))
#----------------------------------------------------------------------
示例12: do_banner
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def do_banner(self, args):
"""Print WebPocket banner"""
ascii_text = text2art("WebPocket", "rand")
self.poutput("\n\n")
self.poutput(ascii_text, '\n\n', color=Fore.LIGHTCYAN_EX)
self.poutput("{art} WebPocket has {count} modules".format(art=art("inlove"), count=self.get_module_count()), "\n\n", color=Fore.MAGENTA)
示例13: banner
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def banner(self):
self.clear()
banner = choice(banners)
color = choice([Fore.GREEN, Fore.YELLOW, Fore.RED, Fore.MAGENTA, Fore.BLUE, Fore.CYAN])
print(color)
print(banner.format('{0}V.{1}{2}'.format(Fore.WHITE, version, Fore.RESET)))
示例14: magenta
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def magenta(text, readline=False):
return Fore.MAGENTA + str(text) + Fore.RESET
示例15: result_collector
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [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('|')