Exemple #1
0
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()
Exemple #2
0
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()
Exemple #3
0
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()
Exemple #4
0
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()
Exemple #5
0
def beautify(string, opts=default_options()):
    b = Beautifier(string, opts)
    return b.beautify()
Exemple #6
0
def beautify(string, opts=None):
    b = Beautifier(string, opts)
    return b.beautify()
Exemple #7
0
def beautify(string, opts=default_options()):
    b = Beautifier(string, opts)
    return b.beautify()