#!/usr/bin/python3 import subprocess import re def echo (bstr): print (bstr.decode(), end='') def script (*args): args = ('./script.sh',) + args p = subprocess.run (args, stdout=subprocess.PIPE) p = p.stdout return p def scriptLines (*args): p = script (*args) p = p.split (b'\n') del p[-1] return p def unescape (bstr): subs = ( ('<','\033[32m/*'), ('>','*/\033[0m'), ('\1','\n'), ('\2','<'), ('\3','>')) for a,b in subs: a = a.encode() b = b.encode() bstr = bstr.replace (a, b) return bstr def isIdent (bstr): if re.search (b'_', bstr): return True elif re.search (b'^[A-Z0-9]*$', bstr): return True else: return False def autoBytes (arg): if type (arg) is str: arg = arg.encode() return arg