blark.format.write_source_to_file

blark.format.write_source_to_file(filename: Path, source: bytes | str, encoding: str = 'utf-8', overwrite: bool = False) None[source]

Write source code to the given file.

Parameters:
filenamepathlib.Path

The filename to write to.

sourcebytes or str

The source code.

encodingstr

The encoding to use when writing the file.

overwritebool

Overwrite a file, if it exists. Otherwise, raise ValueError.