#NEWLINE# @ pytest . fixture #NEWLINE# def completer( ) : #NEWLINE# #INDENT# import pgcli.pgcompleter as pgcompleter #NEWLINE# comp = pgcompleter . PGCompleter ( smart_completion = True ) #NEWLINE# schemata = [ 'public' ] #NEWLINE# comp . extend_schemata ( schemata ) #NEWLINE# ( tables , columns ) = ( [ ] , [ ] ) #NEWLINE# for ( table , cols ) in metadata [ 'tables' ] . items ( ) : #NEWLINE# #INDENT# tables . append ( ( 'public' , table ) ) #NEWLINE# columns . extend ( [ ( 'public' , table , col ) for col in cols ] ) #NEWLINE# #UNINDENT# comp . extend_relations ( tables , kind = 'tables' ) #NEWLINE# comp . extend_columns ( columns , kind = 'tables' ) #NEWLINE# ( views , columns ) = ( [ ] , [ ] ) #NEWLINE# for ( view , cols ) in metadata [ 'views' ] . items ( ) : #NEWLINE# #INDENT# views . append ( ( 'public' , view ) ) #NEWLINE# columns . extend ( [ ( 'public' , view , col ) for col in cols ] ) #NEWLINE# #UNINDENT# comp . extend_relations ( views , kind = 'views' ) #NEWLINE# comp . extend_columns ( columns , kind = 'views' ) #NEWLINE# functions = [ FunctionMetadata ( 'public' , * func_meta ) for func_meta in metadata [ 'functions' ] ] #NEWLINE# comp . extend_functions ( functions ) #NEWLINE# datatypes = [ ( 'public' , typ ) for typ in metadata [ 'datatypes' ] ] #NEWLINE# comp . extend_datatypes ( datatypes ) #NEWLINE# comp . set_search_path ( [ 'public' ] ) #NEWLINE# return comp