(stack, options)
return stack
Setup and return a filter stack.

    Args:
      stack: :class:`~sqlparse.filters.FilterStack` instance
      options: Dictionary with options validated by validate_options.
Setup and return a filter stack.
Setup and return a filter stack .
def build_filter_stack(stack, options):
    """Setup and return a filter stack.

    Args:
      stack: :class:`~sqlparse.filters.FilterStack` instance
      options: Dictionary with options validated by validate_options.
    """
    # Token filter
    if options.get('keyword_case', None):
        stack.preprocess.append(
            filters.KeywordCaseFilter(options['keyword_case']))

    if options.get('identifier_case', None):
        stack.preprocess.append(
            filters.IdentifierCaseFilter(options['identifier_case']))

    # After grouping
    if options.get('strip_comments', False):
        stack.enable_grouping()
        stack.stmtprocess.append(filters.StripCommentsFilter())

    if (options.get('strip_whitespace', False)
        or options.get('reindent', False)):
        stack.enable_grouping()
        stack.stmtprocess.append(filters.StripWhitespaceFilter())

    if options.get('reindent', False):
        stack.enable_grouping()
        stack.stmtprocess.append(
            filters.ReindentFilter(char=options['indent_char'],
                                   width=options['indent_width']))

    if options.get('right_margin', False):
        stack.enable_grouping()
        stack.stmtprocess.append(
            filters.RightMarginFilter(width=options['right_margin']))

    # Serializer
    if options.get('output_format'):
        frmt = options['output_format']
        if frmt.lower() == 'php':
            fltr = filters.OutputPHPFilter()
        elif frmt.lower() == 'python':
            fltr = filters.OutputPythonFilter()
        else:
            fltr = None
        if fltr is not None:
            stack.postprocess.append(fltr)

    return stack
def build_filter_stack ( stack , options ) : # Token filter if options . get ( 'keyword_case' , None ) : stack . preprocess . append ( filters . KeywordCaseFilter ( options [ 'keyword_case' ] ) ) if options . get ( 'identifier_case' , None ) : stack . preprocess . append ( filters . IdentifierCaseFilter ( options [ 'identifier_case' ] ) ) # After grouping if options . get ( 'strip_comments' , False ) : stack . enable_grouping ( ) stack . stmtprocess . append ( filters . StripCommentsFilter ( ) ) if ( options . get ( 'strip_whitespace' , False ) or options . get ( 'reindent' , False ) ) : stack . enable_grouping ( ) stack . stmtprocess . append ( filters . StripWhitespaceFilter ( ) ) if options . get ( 'reindent' , False ) : stack . enable_grouping ( ) stack . stmtprocess . append ( filters . ReindentFilter ( char = options [ 'indent_char' ] , width = options [ 'indent_width' ] ) ) if options . get ( 'right_margin' , False ) : stack . enable_grouping ( ) stack . stmtprocess . append ( filters . RightMarginFilter ( width = options [ 'right_margin' ] ) ) # Serializer if options . get ( 'output_format' ) : frmt = options [ 'output_format' ] if frmt . lower ( ) == 'php' : fltr = filters . OutputPHPFilter ( ) elif frmt . lower ( ) == 'python' : fltr = filters . OutputPythonFilter ( ) else : fltr = None if fltr is not None : stack . postprocess . append ( fltr ) return stack