本文整理汇总了Python中colorama.Back.YELLOW属性的典型用法代码示例。如果您正苦于以下问题:Python Back.YELLOW属性的具体用法?Python Back.YELLOW怎么用?Python Back.YELLOW使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类colorama.Back
的用法示例。
在下文中一共展示了Back.YELLOW属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import YELLOW [as 别名]
def __init__(self):
self.Q = read_questions()
self.answers = {}
self.instruction = Back.YELLOW + "There are a total of " +\
"32 pairs of descriptions. For each pair, choose on a scale of " +\
"1-5. Choose 1 if you are all the way to the left, and choose " +\
"3 if you are in the middle, etc." + Style.RESET_ALL
self.types = ['IE', 'SN', 'FT', 'JP']
self.scoring_scheme = ((30, (15, 23, 27), (3, 7, 11, 19, 31)),
(12, (4, 8, 12, 16, 20, 32), (24, 28)),
(30, (6, 10, 22), (2, 14, 18, 26, 30)),
(18, (1, 5, 13, 21, 29), (9, 17, 25)))
self.scores = []
self.type = []
示例2: print_body_state
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import YELLOW [as 别名]
def print_body_state(self, jarvis, bmi):
"""
According the bmi number, print_body_state finds out the state of the body
and prints it to the user using colorama library for some coloring
"""
print("BMI:", str(bmi))
if bmi < 16:
print(Back.RED, " " * 2, Style.RESET_ALL)
jarvis.say('Severe thinness')
elif bmi < 18.5:
print(Back.YELLOW, " " * 2, Style.RESET_ALL)
jarvis.say('Mild thinness')
elif bmi < 25:
print(Back.GREEN, " " * 2, Style.RESET_ALL)
jarvis.say('Healthy')
elif bmi < 30:
print(Back.YELLOW, " " * 2, Style.RESET_ALL)
jarvis.say('Pre-obese')
else:
print(Back.RED, " " * 2, Style.RESET_ALL)
jarvis.say('Obese')
示例3: print_highlighted
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import YELLOW [as 别名]
def print_highlighted(line, hl_color=Back.WHITE):
"""
Print a highlighted line
"""
try:
# Highlight positives
colorer = re.compile(r'([^\s]+) POSITIVES: ([1-9]) ')
line = colorer.sub(Fore.YELLOW + r'\1 ' + 'POSITIVES: ' + Fore.YELLOW + r'\2 ' + Style.RESET_ALL, line)
colorer = re.compile(r'([^\s]+) POSITIVES: ([0-9]+) ')
line = colorer.sub(Fore.RED + r'\1 ' + 'POSITIVES: ' + Fore.RED + r'\2 ' + Style.RESET_ALL, line)
# Keyword highlight
colorer = re.compile(r'([A-Z_]{2,}:)\s', re.VERBOSE)
line = colorer.sub(Fore.BLACK + hl_color + r'\1' + Style.RESET_ALL + ' ', line)
print(line)
except Exception as e:
pass
示例4: printHighlighted
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import YELLOW [as 别名]
def printHighlighted(line, hl_color=Back.WHITE, tag_color=False):
"""
Print a highlighted line
"""
if tag_color:
# Tags
colorer = re.compile('(HARMLESS|SIGNED|MS_SOFTWARE_CATALOGUE|MSSOFT|SUCCESSFULLY\sCOMMENTED)', re.VERBOSE)
line = colorer.sub(Fore.BLACK + Back.GREEN + r'\1' + Style.RESET_ALL + '', line)
colorer = re.compile('(REVOKED|EXPLOIT|CVE-[0-9\-]+|OBFUSCATED|RUN\-FILE)', re.VERBOSE)
line = colorer.sub(Fore.BLACK + Back.RED + r'\1' + Style.RESET_ALL + '', line)
colorer = re.compile('(EXPIRED|VIA\-TOR|OLE\-EMBEDDED|RTF|ATTACHMENT|ASPACK|UPX|AUTO\-OPEN|MACROS)', re.VERBOSE)
line = colorer.sub(Fore.BLACK + Back.YELLOW + r'\1' + Style.RESET_ALL + '', line)
# Extras
colorer = re.compile('(\[!\])', re.VERBOSE)
line = colorer.sub(Fore.BLACK + Back.LIGHTMAGENTA_EX + r'\1' + Style.RESET_ALL + '', line)
# Add line breaks
colorer = re.compile('(ORIGNAME:)', re.VERBOSE)
line = colorer.sub(r'\n\1', line)
# Standard
colorer = re.compile('([A-Z_]{2,}:)\s', re.VERBOSE)
line = colorer.sub(Fore.BLACK + hl_color + r'\1' + Style.RESET_ALL + ' ', line)
print(line)
示例5: yellow
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import YELLOW [as 别名]
def yellow(s: str) -> str: # pragma: no cover
"""Yellow color string if tty
Args:
s (str): String to color
Returns:
str: Colored string
Examples:
>>> from chepy.modules.internal.colors import yellow
>>> print(YELLOW("some string"))
"""
if sys.stdout.isatty():
return Fore.YELLOW + s + Fore.RESET
else:
return s
示例6: print_highlighted
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import YELLOW [as 别名]
def print_highlighted(line, hl_color=Back.WHITE):
"""
Print a highlighted line
"""
# Tags
colorer = re.compile('(HARMLESS|SIGNED|MS_SOFTWARE_CATALOGUE)', re.VERBOSE)
line = colorer.sub(Fore.BLACK + Back.GREEN + r'\1' + Style.RESET_ALL + ' ', line)
colorer = re.compile('(SIG_REVOKED)', re.VERBOSE)
line = colorer.sub(Fore.BLACK + Back.RED + r'\1' + Style.RESET_ALL + ' ', line)
colorer = re.compile('(SIG_EXPIRED)', re.VERBOSE)
line = colorer.sub(Fore.BLACK + Back.YELLOW + r'\1' + Style.RESET_ALL + ' ', line)
# Extras
colorer = re.compile('(\[!\])', re.VERBOSE)
line = colorer.sub(Fore.BLACK + Back.CYAN + r'\1' + Style.RESET_ALL + ' ', line)
# Standard
colorer = re.compile('([A-Z_]{2,}:)\s', re.VERBOSE)
line = colorer.sub(Fore.BLACK + hl_color + r'\1' + Style.RESET_ALL + ' ', line)
print line
示例7: print_highlighted
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import YELLOW [as 别名]
def print_highlighted(line, hl_color=Back.WHITE):
"""
Print a highlighted line
"""
try:
# Highlight positives
colorer = re.compile(r'([^\s]+) POSITIVES: ([1-9]) ')
line = colorer.sub(Fore.YELLOW + r'\1 ' + 'POSITIVES: ' + Fore.YELLOW + r'\2 ' + Style.RESET_ALL, line)
colorer = re.compile(r'([^\s]+) POSITIVES: ([0-9]+) ')
line = colorer.sub(Fore.RED + r'\1 ' + 'POSITIVES: ' + Fore.RED + r'\2 ' + Style.RESET_ALL, line)
# Keyword highlight
colorer = re.compile(r'([A-Z_]{2,}:)\s', re.VERBOSE)
line = colorer.sub(Fore.BLACK + hl_color + r'\1' + Style.RESET_ALL + ' ', line)
print line
except Exception, e:
pass
示例8: control
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import YELLOW [as 别名]
def control(text):
text = '\n<<< ' + str(text) + ' >>>\n\r'
return Fore.YELLOW + text + Style.RESET_ALL if Color.is_atty() else text
示例9: control_without_arrows
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import YELLOW [as 别名]
def control_without_arrows(text):
text = str(text)
return Fore.YELLOW + text + Style.RESET_ALL if Color.is_atty() else text
示例10: warning
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import YELLOW [as 别名]
def warning(text):
text = '\n\n<<< Warning: ' + str(text) + ' >>>\n'
return Back.YELLOW + text + Style.RESET_ALL if Color.is_atty() else text
示例11: parseLine
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import YELLOW [as 别名]
def parseLine(line):
severity = getSeverity(line)
# Add color based on severity
if 'severity' not in locals():
severity = 3
if severity == 0:
color = Style.DIM + Fore.WHITE
elif severity == 1:
color = Style.NORMAL + Fore.BLUE
elif severity == 2:
color = Style.NORMAL + Fore.CYAN
elif severity == 3:
color = Style.NORMAL + Fore.WHITE
elif severity == 4:
color = Style.NORMAL + Fore.RED
elif severity == 5:
color = Style.NORMAL + Fore.BLACK + Back.RED
else:
color = Style.NORMAL + Fore.BLACK + Back.YELLOW
# Replace html tab entity with actual tabs
line = clearTags(line)
line = line.replace('	', "\t")
return color + line + Style.RESET_ALL
示例12: traverse_next
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import YELLOW [as 别名]
def traverse_next(page, nextx, results, tabular_data_headers=[], verbosity=0):
"""
Recursive generator to traverse through the next attribute and \
crawl through the links to be followed.
:param page: The current page being parsed
:param next: The next attribute of the current scraping dict
:param results: The current extracted content, stored in a dict
:return: The extracted content, through a generator
"""
for link in page.extract_links(selector=nextx['follow_link']):
if verbosity > 0:
print('\n')
print(Back.YELLOW + Fore.BLUE + "Loading page ", link.url + Back.RESET + Fore.RESET, end='')
r = results.copy()
for attribute in nextx['scraping'].get('data'):
if attribute['field'] != "":
if verbosity > 1:
print("\nExtracting", attribute['field'], "attribute", sep=' ', end='')
r[attribute['field']] = link.extract_content(**attribute)
if not nextx['scraping'].get('table'):
result_list = [r]
else:
tables = nextx['scraping'].get('table', [])
for table in tables:
table.update({
'result': r,
'verbosity': verbosity
})
table_headers, result_list = link.extract_tabular(**table)
tabular_data_headers.extend(table_headers)
if not nextx['scraping'].get('next'):
for r in result_list:
yield (tabular_data_headers, r)
else:
for nextx2 in nextx['scraping'].get('next'):
for tdh, result in traverse_next(link, nextx2, r, tabular_data_headers=tabular_data_headers, verbosity=verbosity):
yield (tdh, result)
示例13: yellow_background
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import YELLOW [as 别名]
def yellow_background(s: str) -> str: # pragma: no cover
"""Yellow color string if tty
Args:
s (str): String to color
Returns:
str: Colored string
"""
if sys.stdout.isatty():
return Back.YELLOW + Fore.BLACK + s + Fore.RESET + Back.RESET
else:
return s
示例14: perror
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import YELLOW [as 别名]
def perror(msg: Any, *, end: str = '\n', apply_style: bool = True) -> None:
"""Override perror() method from `cmd2.Cmd`
Use colorama native approach for styling the text instead of `cmd2.ansi` methods
:param msg: message to print (anything convertible to a str with '{}'.format() is OK)
:param end: string appended after the end of the message, default a newline
:param apply_style: If True, then ansi.style_error will be applied to the message text. Set to False in cases
where the message text already has the desired style. Defaults to True.
"""
if apply_style:
final_msg = "{}{}{}{}".format(Fore.RED, Back.YELLOW, msg, Style.RESET_ALL)
else:
final_msg = "{}".format(msg)
ansi.ansi_aware_write(sys.stderr, final_msg + end)
示例15: raw
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import YELLOW [as 别名]
def raw(self, msg, eol=None):
if msg: print(Fore.YELLOW + msg + Style.RESET_ALL, end=eol)
sys.stdout.flush()
# show chit-chat