docs: def rewrite_file(self) -> None:
          """
          Rewrites the source file.
          """
          if not self.needs_rewriting:
              return
          self._info("Rewriting file")
          with open(self.full_path, "w") as outfile:
              self._write(outfile)