tools/generate_stubs/generate_stubs.py
def ParseOptions():
  """Parses the options and terminates program if they are not sane.

  Returns:
    The pair (optparse.OptionValues, [string]), that is the output of
    a successful call to parser.parse_args().
  """
  parser = CreateOptionParser()
  options, args = parser.parse_args()

  if not args:
    parser.error('No inputs specified')

  if options.out_dir is None:
    parser.error('Output location not specified')

  if (options.type not in [
      FILE_TYPE_WIN_X86, FILE_TYPE_WIN_X64, FILE_TYPE_POSIX_STUB,
      FILE_TYPE_WIN_DEF
  ]):
    parser.error('Invalid output file type: %s' % options.type)

  if options.type == FILE_TYPE_POSIX_STUB:
    if options.stubfile_name is None:
      parser.error('Output file name needed for %s' % FILE_TYPE_POSIX_STUB)
    if options.path_from_source is None:
      parser.error('Path from source needed for %s' % FILE_TYPE_POSIX_STUB)

  if options.type == FILE_TYPE_WIN_DEF:
    if options.module_name is None:
      parser.error('Module name needed for %s' % FILE_TYPE_WIN_DEF)

  return options, args
Parses the options and terminates program if they are not sane.

  Returns:
    The pair (optparse.OptionValues, [string]), that is the output of
    a successful call to parser.parse_args().
  
Parses the options and terminates program if they are not sane.
Parses the options and terminates program if they are not sane .
def ParseOptions():
  parser = CreateOptionParser()
  options, args = parser.parse_args()
  if not args:
    parser.error('No inputs specified')
  if options.out_dir is None:
    parser.error('Output location not specified')
  if (options.type not in [
      FILE_TYPE_WIN_X86, FILE_TYPE_WIN_X64, FILE_TYPE_POSIX_STUB,
      FILE_TYPE_WIN_DEF
  ]):
    parser.error('Invalid output file type: %s' % options.type)
  if options.type == FILE_TYPE_POSIX_STUB:
    if options.stubfile_name is None:
      parser.error('Output file name needed for %s' % FILE_TYPE_POSIX_STUB)
    if options.path_from_source is None:
      parser.error('Path from source needed for %s' % FILE_TYPE_POSIX_STUB)
  if options.type == FILE_TYPE_WIN_DEF:
    if options.module_name is None:
      parser.error('Module name needed for %s' % FILE_TYPE_WIN_DEF)
  return options, args
def ParseOptions ( ) : parser = CreateOptionParser ( ) options , args = parser . parse_args ( ) if not args : parser . error ( 'No inputs specified' ) if options . out_dir is None : parser . error ( 'Output location not specified' ) if ( options . type not in [ FILE_TYPE_WIN_X86 , FILE_TYPE_WIN_X64 , FILE_TYPE_POSIX_STUB , FILE_TYPE_WIN_DEF ] ) : parser . error ( 'Invalid output file type: %s' % options . type ) if options . type == FILE_TYPE_POSIX_STUB : if options . stubfile_name is None : parser . error ( 'Output file name needed for %s' % FILE_TYPE_POSIX_STUB ) if options . path_from_source is None : parser . error ( 'Path from source needed for %s' % FILE_TYPE_POSIX_STUB ) if options . type == FILE_TYPE_WIN_DEF : if options . module_name is None : parser . error ( 'Module name needed for %s' % FILE_TYPE_WIN_DEF ) return options , args
Parses the options and terminates program if they are not sane.
Parses the options and terminates program if they are not sane .
"""Parses the options and terminates program if they are not sane.

  Returns:
    The pair (optparse.OptionValues, [string]), that is the output of
    a successful call to parser.parse_args().
  """
The pair (optparse.OptionValues, [string]), that is the output of
a successful call to parser.parse_args().
The pair ( optparse . OptionValues [ string ] ) that is the output of a successful call to parser . parse_args () .