tools/vim/tests/chromium.ycm_extra_conf_unittest.py
def CreateFile(path, copy_from=None, format_with=None, make_executable=False):
  """Creates a file.

  If a file already exists at |path|, it will be overwritten.

  Args:
    path: (String) Absolute path for file to be created.
    copy_from: (String or None) Absolute path to source file. If valid, the
               contents of this file will be written to |path|.
    format_with: (Dictionary or None) Only valid if |copy_from| is also valid.
               The contents of the file at |copy_from| will be passed through
               string.Formatter.vformat() with this parameter as the dictionary.
    make_executable: (Boolean) If true, |file| will be made executable.
  """
  if not os.path.isabs(path):
    raise Exception(
        'Argument |path| needs to be an absolute path. Got: "{}"'.format(path))
  with open(path, 'w') as f:
    if copy_from:
      with open(copy_from, 'r') as source:
        contents = source.read()
        if format_with:
          formatter = string.Formatter()
          contents = formatter.vformat(contents, None, format_with)
        f.write(contents)
  if make_executable:
    statinfo = os.stat(path)
    os.chmod(path, statinfo.st_mode | stat.S_IXUSR)
Creates a file.

  If a file already exists at |path|, it will be overwritten.

  Args:
    path: (String) Absolute path for file to be created.
    copy_from: (String or None) Absolute path to source file. If valid, the
               contents of this file will be written to |path|.
    format_with: (Dictionary or None) Only valid if |copy_from| is also valid.
               The contents of the file at |copy_from| will be passed through
               string.Formatter.vformat() with this parameter as the dictionary.
    make_executable: (Boolean) If true, |file| will be made executable.
  
Creates a file.
If a file already exists at |path|, it will be overwritten.
Creates a file . If a file already exists at |path| it will be overwritten .
def CreateFile(path, copy_from=None, format_with=None, make_executable=False):
  if not os.path.isabs(path):
    raise Exception(
        'Argument |path| needs to be an absolute path. Got: "{}"'.format(path))
  with open(path, 'w') as f:
    if copy_from:
      with open(copy_from, 'r') as source:
        contents = source.read()
        if format_with:
          formatter = string.Formatter()
          contents = formatter.vformat(contents, None, format_with)
        f.write(contents)
  if make_executable:
    statinfo = os.stat(path)
    os.chmod(path, statinfo.st_mode | stat.S_IXUSR)
def CreateFile ( path , copy_from = None , format_with = None , make_executable = False ) : if not os . path . isabs ( path ) : raise Exception ( 'Argument |path| needs to be an absolute path. Got: "{}"' . format ( path ) ) with open ( path , 'w' ) as f : if copy_from : with open ( copy_from , 'r' ) as source : contents = source . read ( ) if format_with : formatter = string . Formatter ( ) contents = formatter . vformat ( contents , None , format_with ) f . write ( contents ) if make_executable : statinfo = os . stat ( path ) os . chmod ( path , statinfo . st_mode | stat . S_IXUSR )
Creates a file.
Creates a file .
"""Creates a file.

  If a file already exists at |path|, it will be overwritten.

  Args:
    path: (String) Absolute path for file to be created.
    copy_from: (String or None) Absolute path to source file. If valid, the
               contents of this file will be written to |path|.
    format_with: (Dictionary or None) Only valid if |copy_from| is also valid.
               The contents of the file at |copy_from| will be passed through
               string.Formatter.vformat() with this parameter as the dictionary.
    make_executable: (Boolean) If true, |file| will be made executable.
  """
path
(String) Absolute path for file to be created.
( String ) Absolute path for file to be created .
copy_from
(String or None) Absolute path to source file. If valid, the
contents of this file will be written to |path|.
( String or None ) Absolute path to source file . If valid the contents of this file will be written to |path| .
format_with
(Dictionary or None) Only valid if |copy_from| is also valid.
The contents of the file at |copy_from| will be passed through
string.Formatter.vformat() with this parameter as the dictionary.
( Dictionary or None ) Only valid if |copy_from| is also valid . The contents of the file at |copy_from| will be passed through string . Formatter . vformat () with this parameter as the dictionary .
make_executable
(Boolean) If true, |file| will be made executable.
( Boolean ) If true |file| will be made executable .