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()
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()
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()
def _fix_pythontidy(src, dst): PythonTidy.tidy_up(src, dst)