parameters: (config_filename)
docstring: Read the file and return a ConfigParser object.
docstring_summary: Read the file and return a ConfigParser object.
docstring_tokens: Read the file and return a ConfigParser object .
function: def _CreateConfigParserFromConfigFile(config_filename):
    """Read the file and return a ConfigParser object."""
    if not os.path.exists(config_filename):
      # Provide a more meaningful error here.
      raise StyleConfigError(
          '"{0}" is not a valid style or file path'.format(config_filename))
    with open(config_filename) as style_file:
      config = py3compat.ConfigParser()
      config.read_file(style_file)
      if config_filename.endswith(SETUP_CONFIG):
        if not config.has_section('yapf'):
          raise StyleConfigError(
              'Unable to find section [yapf] in {0}'.format(config_filename))
      elif config_filename.endswith(LOCAL_STYLE):
        if not config.has_section('style'):
          raise StyleConfigError(
              'Unable to find section [style] in {0}'.format(config_filename))
      else:
        if not config.has_section('style'):
          raise StyleConfigError(
              'Unable to find section [style] in {0}'.format(config_filename))
      return config
function_tokens: def _CreateConfigParserFromConfigFile ( config_filename ) : if not os . path . exists ( config_filename ) : # Provide a more meaningful error here. raise StyleConfigError ( '"{0}" is not a valid style or file path' . format ( config_filename ) ) with open ( config_filename ) as style_file : config = py3compat . ConfigParser ( ) config . read_file ( style_file ) if config_filename . endswith ( SETUP_CONFIG ) : if not config . has_section ( 'yapf' ) : raise StyleConfigError ( 'Unable to find section [yapf] in {0}' . format ( config_filename ) ) elif config_filename . endswith ( LOCAL_STYLE ) : if not config . has_section ( 'style' ) : raise StyleConfigError ( 'Unable to find section [style] in {0}' . format ( config_filename ) ) else : if not config . has_section ( 'style' ) : raise StyleConfigError ( 'Unable to find section [style] in {0}' . format ( config_filename ) ) return config