#NEWLINE# def create_temp_file( self , file_diff ) : #NEWLINE# #INDENT# '\n        Creates a temporary file based on a GitPython file diff\n        This method replicates the original project structure and creates a file with the original name\n\n        :param file_diff: Diff for file\n        :type file_diff: git.diff.Diff\n        ' #NEWLINE# if ( not self . temporary_directory ) : #NEWLINE# #INDENT# raise ValueError ( 'StagingArea not entered' ) #NEWLINE# #UNINDENT# new_version = temporary_file . b_blob #NEWLINE# original_relative_path = new_version . path #NEWLINE# content = new_version . data_stream . stream . read ( ) #NEWLINE# temporary_path = ( self . temporary_directory / original_relative_path ) #NEWLINE# if ( not temporary_path . parent . exists ( ) ) : #NEWLINE# #INDENT# temporary_path . parent . mkdir ( parents = True ) #NEWLINE# #UNINDENT# with temporary_path . open ( 'wb' ) as temporary_file : #NEWLINE# #INDENT# temporary_file . write ( content ) #NEWLINE# #UNINDENT# return temporary_path