def beautify_file(file_name, opts=default_options()): if file_name == '-': # stdin stream = sys.stdin else: stream = open(file_name) content = ''.join(stream.readlines()) b = Beautifier(content, opts) return b.beautify()
def beautify_file(file_name, opts=default_options()): if file_name == '-': # stdin try: if sys.stdin.isatty(): raise Exception() stream = sys.stdin except Exception: print("Must pipe input or define input file.\n", file=sys.stderr) usage(sys.stderr) raise Exception() else: stream = open(file_name) content = ''.join(stream.readlines()) b = Beautifier(content, opts) return b.beautify()
def beautify(string, opts=default_options()): b = Beautifier(string, opts) return b.beautify()
def beautify(string, opts=None): b = Beautifier(string, opts) return b.beautify()