def _validate_pythontidy(fd):
    source = StringIO(fd.read())
    if len(source.getvalue()) < 4:
        # small or empty files are ignored
        return True
    formatted = StringIO()
    PythonTidy.tidy_up(source, formatted)
    return source.getvalue() == formatted.getvalue()
Example #2
0
def _validate_pythontidy(fd):
    if is_python3(fd) or running_on_py3:
        # PythonTidy supports Python 2 only
        return True
    source = StringIO(fd.read())
    if len(source.getvalue()) < 4:
        # small or empty files are ignored
        return True
    formatted = StringIO()
    PythonTidy.tidy_up(source, formatted)
    return source.getvalue() == formatted.getvalue()
Example #3
0
def _validate_pythontidy(fd):
    if is_python3(fd):
        # PythonTidy supports Python 2 only
        return True
    source = StringIO(fd.read())
    if len(source.getvalue()) < 4:
        # small or empty files are ignored
        return True
    formatted = StringIO()
    PythonTidy.tidy_up(source, formatted)
    return source.getvalue() == formatted.getvalue()
Example #4
0
def _fix_pythontidy(src, dst):
    PythonTidy.tidy_up(src, dst)
Example #5
0
def _fix_pythontidy(src, dst):
    PythonTidy.tidy_up(src, dst)