#NEWLINE# @ contextmanager #NEWLINE# def jslines( n = 3 ) : #NEWLINE# #INDENT# d = tempfile . mkdtemp ( ) #NEWLINE# files = [ ] #NEWLINE# dfc = df . copy ( ) #NEWLINE# for i in range ( n ) : #NEWLINE# #INDENT# ( _ , fn ) = tempfile . mkstemp ( suffix = '.json' , dir = d ) #NEWLINE# dfc [ 'id' ] += i #NEWLINE# odo ( fn , ( 'jsonlines://%s' % fn ) ) #NEWLINE# files . append ( fn ) #NEWLINE# #UNINDENT# ( yield d ) #NEWLINE# with ignoring ( OSError ) : #NEWLINE# #INDENT# shutil . rmtree ( d )