Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_repr(self):
self.assertEqual(fmtstr('hello', 'red', bold=False), red('hello'))
self.assertEqual(fmtstr('hello', 'red', bold=True), bold(red('hello')))
import sys
from curtsies.fmtfuncs import blue, red, bold, on_red
from curtsies.window import Window
from curtsies.terminal import Terminal
if __name__ == '__main__':
print(blue('hey') + ' ' + red('there') + ' ' + red(bold('you')))
with Terminal(sys.stdin, sys.stdout) as tc:
with Window(tc) as t:
rows, columns = t.tc.get_screen_size()
while True:
c = t.tc.get_event()
if c == "":
sys.exit() # same as raise SystemExit()
elif c == "a":
a = [blue(on_red(c*columns)) for _ in range(rows)]
elif c == "b":
a = t.array_from_text("a small array")
else:
a = t.array_from_text("try a, b, or ctrl-D")
t.render_to_terminal(a)
bolds = {token_color: lambda x: bold(token_color(x)),
arg_color: lambda x: bold(arg_color(x))}
arg_color: lambda x: bold(arg_color(x)),
}
token_color: lambda x: bold(token_color(x)),
arg_color: lambda x: bold(arg_color(x)),
arg_color: lambda x: bold(arg_color(x))}