(file_name)
Write a default config file.
Write a default config file.
Write a default config file .
def _build_default_config_file(file_name):
    """Write a default config file."""
    argnames = sorted(ARGUMENTS.keys())
    try:
        with io.open(file_name, 'w', encoding='utf_8_sig', errors='replace') as f:
            f.write(CONFIG_HEADER)
            for a in argnames:
                try:
                    f.write(
                        u'## choices: %s\n' %
                        u', '.join(u'%s' % (_s,) for _s in ARGUMENTS[a][u'choices'])
                    )
                except(KeyError, TypeError):
                    pass
                try:
                    # check if it's a list
                    ARGUMENTS[a][u'list']
                    formatted = u','.join(u'%s' % (_s,) for _s in ARGUMENTS[a][u'default'])
                except(KeyError, TypeError):
                    formatted = u'%s' % (ARGUMENTS[a][u'default'],)
                f.write(u'#%s=%s\n' % (a, formatted))
            f.write(CONFIG_FOOTER)
    except (OSError, IOError):
        # can't create file, ignore. we'll get a message later.
        pass
def _build_default_config_file ( file_name ) : argnames = sorted ( ARGUMENTS . keys ( ) ) try : with io . open ( file_name , 'w' , encoding = 'utf_8_sig' , errors = 'replace' ) as f : f . write ( CONFIG_HEADER ) for a in argnames : try : f . write ( u'## choices: %s\n' % u', ' . join ( u'%s' % ( _s , ) for _s in ARGUMENTS [ a ] [ u'choices' ] ) ) except ( KeyError , TypeError ) : pass try : # check if it's a list ARGUMENTS [ a ] [ u'list' ] formatted = u',' . join ( u'%s' % ( _s , ) for _s in ARGUMENTS [ a ] [ u'default' ] ) except ( KeyError , TypeError ) : formatted = u'%s' % ( ARGUMENTS [ a ] [ u'default' ] , ) f . write ( u'#%s=%s\n' % ( a , formatted ) ) f . write ( CONFIG_FOOTER ) except ( OSError , IOError ) : # can't create file, ignore. we'll get a message later. pass