Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if db.get_latest_repo_full_name() == repo.full_name:
break
print_text(repo.full_name, color=Fore.BLUE if enable_color else None)
repo_list.append({
'full_name': repo.full_name,
'name': repo.name,
'url': repo.html_url,
'language': repo.language,
'description': repo.description,
})
if repo_list:
t1 = datetime.now()
print_text('Saving repo data...', color=Fore.GREEN if enable_color else None, reset_color=False)
db.update(repo_list)
t2 = datetime.now()
print_text('Done. (took {:d}s)'.format((t2 - t1).total_seconds()),
color=Fore.RED if enable_color else None)
else:
print_text('No new stars found.', color=Fore.RED if enable_color else None)
sys.exit(0)
if parsed_args.install:
if parsed_args.three:
filename = 'ohmystars.alfredworkflow'
else:
filename = 'ohmystars-v2.alfredworkflow'
def display(text):
ipython_display(HTML(text))
else:
from tqdm import tqdm
display = print
FG = 0
BG = 1
# TODO: create a set of HTML color to allows richer display in colab
colors = {
'black': [Fore.BLACK, Back.BLACK],
'red': [Fore.RED, Back.RED],
'green': [Fore.GREEN, Back.GREEN],
'yellow': [Fore.YELLOW, Back.YELLOW],
'blue': [Fore.BLUE, Back.BLUE],
'magenta': [Fore.MAGENTA, Back.MAGENTA],
'cyan': [Fore.CYAN, Back.CYAN],
'white': [Fore.WHITE, Back.WHITE],
}
styles = {
"dim": Style.DIM,
"normal": Style.NORMAL,
"bright": Style.BRIGHT,
"reset": Style.RESET_ALL
}
# Shorthand functions
'''
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
'''
BORDER = Fore.CYAN
MSG = '\033[94m'
TITLE = '\033[92m'
SETTING = Fore.MAGENTA + Style.BRIGHT
STEPS = Fore.CYAN + Style.BRIGHT
CODE = Fore.GREEN + Style.DIM
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
CMD = Back.GREEN + Fore.RED
def prompt(self, msg = None):
if msg != None:
print(msg)
print('> ', end = '')
async def execute_procedure(protocol_id, procedure, session):
await asyncio.sleep(procedure["time"])
print(Fore.GREEN + f"executing: {procedure} at {time.time()}")
me.update_from_params(procedure["params"])
me.update()
await log(session, dumps(dict(
protocol_id=protocol_id,
timestamp=time.time(),
success=True,
procedure=procedure)))
def log(mes_type, message):
global alerts, warnings
try:
# Default
color = Fore.WHITE
# Print to console
if mes_type == "ERROR":
color = Fore.MAGENTA
if mes_type == "INFO":
color = Fore.GREEN + Style.BRIGHT
if mes_type == "ALERT":
color = Fore.RED
alerts += 1
if mes_type == "DEBUG":
if not args.debug:
return
color = Fore.WHITE
if mes_type == "WARNING":
color = Fore.YELLOW
warnings += 1
if mes_type == "NOTICE":
color = Fore.CYAN
if mes_type == "RESULT":
if "clean" in message.lower():
color = Fore.BLACK+Back.GREEN
elif "suspicious" in message.lower():
if win_indices is not None and (i, j) in win_indices:
color += Back.LIGHTYELLOW_EX
print(" ", end="")
if sx[i, j] and so[i, j]:
print(Fore.RED + "?" + Fore.RESET, end="")
elif sx[i, j]:
print(color + "X" + Style.RESET_ALL, end="")
elif so[i, j]:
print(color + "O" + Style.RESET_ALL, end="")
else:
print(".", end="")
if q is not None:
print(" ", end="")
for j in xrange(board_size):
if (i, j) == move_index:
color = Fore.GREEN
else:
color = Fore.BLACK
if not (sx[i, j] or so[i, j]) or (i, j) == move_index:
print(color + " %6.3f" % q[i, j] + Style.RESET_ALL, end="")
else:
print(Fore.LIGHTBLACK_EX + " * " + Style.RESET_ALL, end="")
print()
print()
self.logger.info(f'Question {message["questionNumber"]} out of {message["questionCount"]}')
self.logger.info(question, extra={"pre": colorama.Fore.BLUE})
self.logger.info(f'Choices: {", ".join(choices)}', extra={'pre': colorama.Fore.BLUE})
await self.question_handler.answer_question(question, choices)
self.block_chat = True
elif self.show_question_summary and message['type'] == 'questionSummary':
question = unidecode(message['question'])
self.logger.info(f'Question summary: {question}', extra={'pre': colorama.Fore.BLUE})
for answer in message['answerCounts']:
ans_str = unidecode(answer['answer'])
self.logger.info(f'{ans_str}:{answer["count"]}:{answer["correct"]}',
extra={'pre': colorama.Fore.GREEN if answer['correct'] else colorama.Fore.RED})
self.logger.info(f'{message["advancingPlayersCount"]} players advancing')
self.logger.info(f'{message["eliminatedPlayersCount"]} players eliminated\n')
elif self.show_chat and self.block_chat and message['type'] == 'questionClosed':
self.block_chat = False
self.logger.info('\n' * 5)
self.logger.info('Disconnected.')
def printColorsCode():
print(Style.RESET_ALL + ' Colors code for results: ', file=sys.stderr)
print(Fore.YELLOW+' INFO (Information)'+Style.RESET_ALL+','+Fore.GREEN+' PASS (Recommended value), '+Fore.RED+' FAIL (Fix required)'+Style.RESET_ALL+','+Fore.MAGENTA+" Not Scored "+Style.RESET_ALL, file=sys.stderr)
def stats_found(self, password, attempts, browsers):
self.stats(password, attempts, browsers, load=False)
if self.__is_color:
print('\n{0}[{1}!{0}] {2}Password Found{3}'.format(
Fore.YELLOW, Fore.RED, Fore.WHITE, Fore.RESET
))
print('{0}[{1}+{0}] {2}Username: {1}{3}{4}'.format(
Fore.YELLOW, Fore.GREEN, Fore.WHITE, self.username.title(), Fore.RESET
))
print('{0}[{1}+{0}] {2}Password: {1}{3}{4}'.format(
Fore.YELLOW, Fore.GREEN, Fore.WHITE, password, Fore.RESET
))
else:
print('\n[!] Password Found\n[+] Username: {}\n[+] Password: {}'.format(
self.username.title(), password
))
sleep(self.delay)
def print_info(s):
"""
Prints text in green bright font.
:param s: String, text to be printed.
:return: None.
"""
print(Style.BRIGHT + Fore.GREEN + s + Style.RESET_ALL)