#NEWLINE# def repository( **kwargs ) : #NEWLINE# #INDENT# if ( 'url' not in result ) : #NEWLINE# #INDENT# kwargs [ 'url' ] = 'https://github.com/example-{0}/example.git' . format ( random . randint ( 1 , 100000 ) ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# result = Repository . query . filter_by ( url = kwargs [ 'url' ] ) [ 0 ] #NEWLINE# #UNINDENT# except IndexError : #NEWLINE# #INDENT# result = Repository ( ** kwargs ) #NEWLINE# db . session . add ( result ) #NEWLINE# #UNINDENT# return result