def refactor_file()

in bowler/tool.py [0:0]


    def refactor_file(self, filename: str, *a, **k) -> List[Hunk]:
        try:
            hunks: List[Hunk] = []
            input, encoding = self._read_python_source(filename)
            if input is None:
                # Reading the file failed.
                return hunks
        except (OSError, UnicodeDecodeError) as e:
            log.error(f"Skipping {filename}: failed to read because {e}")
            return hunks

        try:
            if not input.endswith("\n"):
                input += "\n"
            tree = self.refactor_string(input, filename)
            if tree:
                hunks = self.processed_file(str(tree), filename, input)
        except ParseError as e:
            log.exception("Skipping {filename}: failed to parse ({e})")

        return hunks