(options)
return options
Validates options.
Validates options.
Validates options .
def validate_options(options):
    """Validates options."""
    kwcase = options.get('keyword_case', None)
    if kwcase not in [None, 'upper', 'lower', 'capitalize']:
        raise SQLParseError('Invalid value for keyword_case: %r' % kwcase)

    idcase = options.get('identifier_case', None)
    if idcase not in [None, 'upper', 'lower', 'capitalize']:
        raise SQLParseError('Invalid value for identifier_case: %r' % idcase)

    ofrmt = options.get('output_format', None)
    if ofrmt not in [None, 'sql', 'python', 'php']:
        raise SQLParseError('Unknown output format: %r' % ofrmt)

    strip_comments = options.get('strip_comments', False)
    if strip_comments not in [True, False]:
        raise SQLParseError('Invalid value for strip_comments: %r'
                            % strip_comments)

    strip_ws = options.get('strip_whitespace', False)
    if strip_ws not in [True, False]:
        raise SQLParseError('Invalid value for strip_whitespace: %r'
                            % strip_ws)

    reindent = options.get('reindent', False)
    if reindent not in [True, False]:
        raise SQLParseError('Invalid value for reindent: %r'
                            % reindent)
    elif reindent:
        options['strip_whitespace'] = True
    indent_tabs = options.get('indent_tabs', False)
    if indent_tabs not in [True, False]:
        raise SQLParseError('Invalid value for indent_tabs: %r' % indent_tabs)
    elif indent_tabs:
        options['indent_char'] = '\t'
    else:
        options['indent_char'] = ' '
    indent_width = options.get('indent_width', 2)
    try:
        indent_width = int(indent_width)
    except (TypeError, ValueError):
        raise SQLParseError('indent_width requires an integer')
    if indent_width < 1:
        raise SQLParseError('indent_width requires an positive integer')
    options['indent_width'] = indent_width

    right_margin = options.get('right_margin', None)
    if right_margin is not None:
        try:
            right_margin = int(right_margin)
        except (TypeError, ValueError):
            raise SQLParseError('right_margin requires an integer')
        if right_margin < 10:
            raise SQLParseError('right_margin requires an integer > 10')
    options['right_margin'] = right_margin

    return options
def validate_options ( options ) : kwcase = options . get ( 'keyword_case' , None ) if kwcase not in [ None , 'upper' , 'lower' , 'capitalize' ] : raise SQLParseError ( 'Invalid value for keyword_case: %r' % kwcase ) idcase = options . get ( 'identifier_case' , None ) if idcase not in [ None , 'upper' , 'lower' , 'capitalize' ] : raise SQLParseError ( 'Invalid value for identifier_case: %r' % idcase ) ofrmt = options . get ( 'output_format' , None ) if ofrmt not in [ None , 'sql' , 'python' , 'php' ] : raise SQLParseError ( 'Unknown output format: %r' % ofrmt ) strip_comments = options . get ( 'strip_comments' , False ) if strip_comments not in [ True , False ] : raise SQLParseError ( 'Invalid value for strip_comments: %r' % strip_comments ) strip_ws = options . get ( 'strip_whitespace' , False ) if strip_ws not in [ True , False ] : raise SQLParseError ( 'Invalid value for strip_whitespace: %r' % strip_ws ) reindent = options . get ( 'reindent' , False ) if reindent not in [ True , False ] : raise SQLParseError ( 'Invalid value for reindent: %r' % reindent ) elif reindent : options [ 'strip_whitespace' ] = True indent_tabs = options . get ( 'indent_tabs' , False ) if indent_tabs not in [ True , False ] : raise SQLParseError ( 'Invalid value for indent_tabs: %r' % indent_tabs ) elif indent_tabs : options [ 'indent_char' ] = '\t' else : options [ 'indent_char' ] = ' ' indent_width = options . get ( 'indent_width' , 2 ) try : indent_width = int ( indent_width ) except ( TypeError , ValueError ) : raise SQLParseError ( 'indent_width requires an integer' ) if indent_width < 1 : raise SQLParseError ( 'indent_width requires an positive integer' ) options [ 'indent_width' ] = indent_width right_margin = options . get ( 'right_margin' , None ) if right_margin is not None : try : right_margin = int ( right_margin ) except ( TypeError , ValueError ) : raise SQLParseError ( 'right_margin requires an integer' ) if right_margin < 10 : raise SQLParseError ( 'right_margin requires an integer > 10' ) options [ 'right_margin' ] = right_margin return options