parameters: (raw_options, apply_config)
return_statement: return options
docstring: Return parsed options.
docstring_summary: Return parsed options.
docstring_tokens: Return parsed options .
function: def _get_options(raw_options, apply_config):
      """Return parsed options."""
      if not raw_options:
          return parse_args([''], apply_config=apply_config)
  
      if isinstance(raw_options, dict):
          options = parse_args([''], apply_config=apply_config)
          for name, value in raw_options.items():
              if not hasattr(options, name):
                  raise ValueError("No such option '{}'".format(name))
  
              # Check for very basic type errors.
              expected_type = type(getattr(options, name))
              if not isinstance(expected_type, (str, unicode)):
                  if isinstance(value, (str, unicode)):
                      raise ValueError(
                          "Option '{}' should not be a string".format(name))
              setattr(options, name, value)
      else:
          options = raw_options
  
      return options
function_tokens: def _get_options ( raw_options , apply_config ) : if not raw_options : return parse_args ( [ '' ] , apply_config = apply_config ) if isinstance ( raw_options , dict ) : options = parse_args ( [ '' ] , apply_config = apply_config ) for name , value in raw_options . items ( ) : if not hasattr ( options , name ) : raise ValueError ( "No such option '{}'" . format ( name ) ) # Check for very basic type errors. expected_type = type ( getattr ( options , name ) ) if not isinstance ( expected_type , ( str , unicode ) ) : if isinstance ( value , ( str , unicode ) ) : raise ValueError ( "Option '{}' should not be a string" . format ( name ) ) setattr ( options , name , value ) else : options = raw_options return options