Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Fore.BLUE + 'TEST' + Style.RESET_ALL,
colored('TEST', 'blue'),
])
def test_colors(outer_widths, left, intersect, right, title, expected):
"""Test with color title characters.
:param iter outer_widths: List of integers representing column widths with padding.
:param str left: Left border.
:param str intersect: Column separator.
:param str right: Right border.
:param title: Title in border with color codes.
:param str expected: Expected output.
"""
if left and right:
expected = left + expected + right
actual = build_border(outer_widths, '-', left, intersect, right, title=title)
assert ''.join(actual) == expected
import userinterface
import colorama
rig = eightbyeight.EightByEightTestRig()
while True:
message = """
_____ ______ _______ __
| __ \| ____| /\ | __ \ \ / /
| |__) | |__ / \ | | | \ \_/ /
| _ /| __| / /\ \ | | | |\ /
| | \ \| |____ / ____ \| |__| | | |
|_| \_\______/_/ \_\_____/ |_|
"""
userinterface.interface.DisplayMessage(message, fgcolor=colorama.Fore.BLUE)
while (not rig.testrig.readStartButton()):
pass
rig.testrig.setLED("pass", True)
rig.testrig.setLED("fail", True)
#runner = unittest.TextTestRunner(failfast = True)
#runner = redgreenunittest.TextTestRunner(failfast = True)
runner = blinkinlabsunittest.BlinkinlabsTestRunner(failfast = True)
result = runner.run(unittest.TestLoader().loadTestsFromTestCase(EightByEightTests))
if len(result.failures) > 0 or len(result.errors) > 0:
rig.testrig.setLED("pass", False)
rig.testrig.setLED("fail", True)
def convert_to_mp3(self, video):
"""
Converts the downloaded video file to MP3
Args:
video: A path to the downloaded video file
Returns:
The path of the converted MP3 file
"""
logging.info(Fore.BLUE+'♬ '+Style.RESET_ALL+'Converting to MP3')
artist_dir = os.path.expanduser('~/Downloads/Music/')
artist_dir = os.path.join(artist_dir, self.artist.replace('/',''))
if not os.path.exists(artist_dir):
os.makedirs(artist_dir)
song_path = os.path.join(artist_dir, self.filename+'.mp3')
# TODO: Write test to cover
if os.path.exists(song_path):
self.filename = self.filename+' ('+self.album+')'
song_path = os.path.join(artist_dir, self.filename+'.mp3')
pydub.AudioSegment.from_file(video).export(song_path, format='mp3')
return song_path
def main():
print(Fore.BLUE + logo + Fore.RESET)
args = get_args()
metafile, map_dict = get_metadata(args)
if args.mode == "prefetch":
prefetch_dl(args, metafile, map_dict)
else:
ena_dl(args, metafile, map_dict)
print(Fore.BLUE + "\nIt's over, it's done!\n" + Fore.RESET)
def play(data):
if len(data) == 0:
print(Fore.BLUE + "Song name doesn't exist. (play '"'song name'"') " + Fore.RESET)
else:
wanted = data
find = os.popen("ls | grep -i " + '"' + wanted + '"')
music = str(find.readline())
if not music:
os.system("instantmusic -s " + wanted + " 2> /dev/null")
find = os.popen("ls -tc --hide='__*' --hide='*.py'")
music = str(find.readline()).replace("\n", "")
os.system("XDG_CURRENT_DESKTOP= DESKTOP_SESSION= xdg-open " +
music.replace(" ", "\ ").replace(" (", " \("). replace(")", "\)") +
" 2> /dev/null")
else:
os.system("XDG_CURRENT_DESKTOP= DESKTOP_SESSION= xdg-open " +
def make_blue(string):
return format_str(string, colorama.Fore.BLUE)
result
sync
trajectory
{fr}{sr}
Pre-loaded modules from {bright}evo.tools:{blue}
file_interface
pandas_bridge
plot
{fr}{sr}
Pre-loaded high-level functions for metrics:{blue}
ape(...)
rpe(...)
{fr}
Others: numpy as np, matplotlib.pyplot as plt, pandas as pd, seaborn as sns
'''.format(fr=Fore.RESET, sr=Style.RESET_ALL, bright=Style.BRIGHT,
blue=Fore.BLUE, green=Fore.GREEN)
def run(self):
selectorClass = getattr(
eval(self.config['selector_type']),
self.config['selector_type'].title() + 'Selector'
)
results = dict()
results['project'] = self.args['']
results['data'] = list()
try:
result = dict()
tabular_data_headers = dict()
if self.args['--verbosity'] > 0:
print()
print(Back.YELLOW + Fore.BLUE + "Loading page ", self.config['scraping']['url'] \
+ Back.RESET + Fore.RESET, end='')
selector = selectorClass(self.config['scraping']['url'])
for attribute in self.config['scraping']['data']:
if attribute['field'] != "":
if self.args['--verbosity'] > 1:
print("\nExtracting", attribute['field'], "attribute", sep=' ', end='')
result[attribute['field']] = selector.extract_content(**attribute)
if not self.config['scraping'].get('table'):
result_list = [result]
else:
tables = self.config['scraping'].get('table', [])
for table in tables:
if table.get('selector', '').strip() != '':
table.update({
'result': result,
'verbosity': self.args['--verbosity']