def FormatFile(filename,
               style_config=None,
               lines=None,
               print_diff=False,
               verify=True,
               in_place=False,
               logger=None):
  _CheckPythonVersion()

  if in_place and print_diff:
    raise ValueError('Cannot pass both in_place and print_diff.')

  original_source, encoding = ReadFile(filename, logger)
  reformatted_source, changed = FormatCode(original_source,
                                           style_config=style_config,
                                           filename=filename,
                                           lines=lines,
                                           print_diff=print_diff,
                                           verify=verify)
  if in_place:
    if original_source and original_source != reformatted_source:
      file_resources.WriteReformattedCode(filename, reformatted_source,
                                          in_place, encoding)
    return None, encoding, changed

  return reformatted_source, encoding, changed
Format a single Python file and return the formatted code.
dataset/ETHPy150Open google/yapf/yapf/yapflib/yapf_api.py/FormatFile