Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
API = TestRailApiUtils(URL)
API.user = EMAIL
API.password = PASSWORD
# Main
if publish_results(
API,
TESTCASES,
run_id=ARGUMENTS.run_id,
plan_id=ARGUMENTS.plan_id,
version=VERSION,
publish_blocked=PUBLISH_BLOCKED):
print(Fore.GREEN + 'OK' + Fore.RESET)
sys.exit()
else:
print(Fore.LIGHTRED_EX + 'ERROR' + Fore.RESET)
sys.exit(1)
"Change your brightness to create your first data sample (there is no data found)."
)
return
data = pipeline.transform(data)
# y is nans in this case
X, _ = data[:, :-1], data[:, -1]
pred = int(100 * clf.predict(X)[0])
tmpl = (
"new_brightness="
+ Fore.GREEN
+ "{}%"
+ Fore.RESET
+ " app="
+ Fore.GREEN
+ "{}"
+ Fore.RESET
)
print(tmpl.format(pred, features["display_window_class"].split()[-1]))
print()
self.bm.set_by_percentage(pred)
else:
print("PREDICTING!")
self.old_value = new_value
print('\n')
choice = input('Select feed by numerical ID (1-{})\n> '.format(len(newlist)))
if int(choice) in range(1, len(newlist) + 1): # condition to check if proper feed was selected.
mod = newlist[int(choice) - 1] # Using choice number to locate item in the feed list
methodToCall = getattr(feedmods, mod) # saving the function with newlist argument as variable
methodToCall()
else:
print((Fore.RED + '[-]' + Fore.RESET + ' Invalid option. Exiting...'))
exit(0)
elif args.extract:
os.chdir('../../')
filename = args.extract[0]
base = os.path.basename(filename)
print((Fore.YELLOW + '[*]' + Fore.RESET + ' Extracting indicators from {}'.format(base)))
extract(filename)
elif args.cbgen:
try:
ioc = os.listdir('.')
for i in ioc:
if '_ioc' in i:
raise StopIteration()
print((Fore.RED + '[-] ' + Fore.RESET + ' No IOC files found.'))
print((Fore.YELLOW + '\r\n[*] ' + Fore.RESET + ' Please gather IOCs through --feeds update, or --extract for local files'))
exit(0)
except StopIteration:
print((Fore.GREEN + '[+] ' + Fore.RESET + 'IOCs found, continuing to feed generation\n'))
pass
def status():
"""
Print the status of all providers
"""
for i, provider in enumerate(providers):
color = colorama.Fore.RESET
if provider.status == ProviderStatus.GREEN:
color = colorama.Fore.GREEN
if provider.status == ProviderStatus.YELLOW:
color = colorama.Fore.YELLOW
if provider.status == ProviderStatus.RED:
color = colorama.Fore.RED
if provider.status == ProviderStatus.AUTH_FAIL:
color = colorama.Fore.BLUE
print color + str(i) + ":", str(provider)
print colorama.Fore.RESET,
board = backlog_board()
card = card_by_id(cli_args.card_id, board)
if not card:
return
print(f'{colorama.Fore.YELLOW}{colorama.Style.BRIGHT}{card.name}{colorama.Fore.RESET}')
print(f'Due: {format_due_date(card)}{colorama.Fore.RESET}{colorama.Style.NORMAL}')
for comment in sorted(card.get_comments(), key=lambda c: c['date'], reverse=True):
comment_datetime = str(dateutil.parser.parse(comment['date']))
print(f'{colorama.Fore.BLUE}{comment_datetime}', end=' ')
print(f'{colorama.Fore.GREEN}{comment["data"]["text"]}')
print(colorama.Fore.RESET, end='')
"contact the developers." % (colorama.Fore.GREEN,
colorama.Fore.RESET))
else:
folder = \
self.comm.project.get_output_folder(
type="validation",
tag="data_integrity_report")
filename = os.path.join(folder, "report.txt")
seperator_string = "\n" + 80 * "=" + "\n" + 80 * "=" + "\n"
with open(filename, "wt") as fh:
for report in self._reports:
fh.write(report.strip())
fh.write(seperator_string)
print("\n%sFAILED%s\nEncountered %i errors!\n"
"A report has been created at '%s'.\n" %
(colorama.Fore.RED, colorama.Fore.RESET,
self._total_error_count, os.path.relpath(filename)))
if files_failing_raypath_test:
# Put quotes around the filenames
files_failing_raypath_test = ['"%s"' % _i for _i in
files_failing_raypath_test]
filename = os.path.join(folder,
"delete_raypath_violating_files.sh")
with open(filename, "wt") as fh:
fh.write("# CHECK THIS FILE BEFORE EXECUTING!!!\n")
fh.write("rm ")
fh.write("\nrm ".join(files_failing_raypath_test))
print("\nSome files failed the raypath in domain checks. A "
"script which deletes the violating files has been "
"created. Please check and execute it if necessary:\n"
"'%s'" % filename)
def ask(jarvis, s):
"""Start chatting with Jarvis"""
brain = Brain()
jarvis.say("Ask me anything\n type 'leave' to stop", Fore.BLUE)
stay = True
while stay:
text = str.upper(input(Fore.RED + ">> " + Fore.RESET))
if text == "LEAVE":
jarvis.say("Thanks for talking to me")
stay = False
else:
jarvis.say(brain.respond(text))
SAVE_STDOUT = sys.stdout
SAVE_STDERR = sys.stderr
class ExeTypes(Enum):
EXECUTE = 'EXECUTE',
NZBGET = 'NZBGET',
SABNZBD = 'SABNZBD',
SYNOLOGYDLS = 'SYNOLOGYDLS'
class Col:
OK = Fore.GREEN + Style.BRIGHT
WARN = Fore.YELLOW + Style.BRIGHT
FAIL = Fore.RED + Style.BRIGHT
OFF = Fore.RESET + Style.RESET_ALL
# region NZB-Verifier
class NZBSegment(object):
def __init__(self, bytes_, number, message_id=None):
"""NZB Segment
:param int bytes_: Size in bytes
:param int number: Segment number
:param str message_id: MessageID
"""
self.bytes_ = int(bytes_)
self.number = int(number)
board = backlog_board()
card = card_by_id(cli_args.card_id, board)
if not card:
return
print(f'{colorama.Fore.YELLOW}{colorama.Style.BRIGHT}{card.name}{colorama.Fore.RESET}')
print(f'Due: {format_due_date(card)}{colorama.Fore.RESET}')
for comment in sorted(card.get_comments(), key=lambda c: c['date'], reverse=True):
comment_datetime = str(dateutil.parser.parse(comment['date']))
print(f'{colorama.Fore.BLUE}{comment_datetime}', end=' ')
print(f'{colorama.Fore.GREEN}{comment["data"]["text"]}')
print(colorama.Fore.RESET, end='')
if cnt == 5:
break
news_contents = []
divs = soup.findAll("div")
cnt = 1
for i in divs:
if i.get('class')!=None and "esc-lead-snippet-wrapper" in i.get('class'):
news_contents.append(str(i.get_text()))
cnt += 1
if cnt == 5:
break
i = 0
while i < len(title_contents):
print (Fore.GREEN + str(i + 1) + " - " + title_contents[i] + Fore.RESET)
i += 1
print("Type index to expand news\n")
try:
idx = int(raw_input())
except:
idx = int(input())
idx -= 1
print(">> {0} {1} {2}\n".format(Fore.BLUE, news_contents[idx], Fore.RESET))
print("{0}\n Do you want to read more? (yes/no): {1}".format(Fore.RED, Fore.RESET))
try:
take_yn = raw_input()
except:
take_yn = input()
if take_yn.lower() == "yes":