#NEWLINE# def _BuildFileFakeFileSystem( self , filename , number_of_segments , segment_file_path_specs ) : #NEWLINE# #INDENT# 'Builds a fake file system containing EWF segment files.\n\n    Args:\n      filename: the filename of the first segment file with extension.\n      number_of_segments: the number of segments.\n      segment_file_path_specs: a list to store the segment file path\n                               specifications in.\n\n    Returns:\n      The fake file system (instance of dvfvs.FakeFileSystem).\n    ' #NEWLINE# resolver_context = context . Context ( ) #NEWLINE# file_system = fake_file_system . FakeFileSystem ( resolver_context ) #NEWLINE# file_system . AddFileEntry ( '/' , file_entry_type = definitions . FILE_ENTRY_TYPE_DIRECTORY ) #NEWLINE# ( filename , _ , extension ) = filename . partition ( '.' ) #NEWLINE# number_of_segments += 1 #NEWLINE# for segment_number in range ( 1 , number_of_segments ) : #NEWLINE# #INDENT# if ( segment_number < 100 ) : #NEWLINE# #INDENT# if ( extension [ 1 ] == 'x' ) : #NEWLINE# #INDENT# path = '/{0:s}.{1:s}x{2:02d}' . format ( filename , extension [ 0 ] , segment_number ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# path = '/{0:s}.{1:s}{2:02d}' . format ( filename , extension [ 0 ] , segment_number ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# segment_index = ( segment_number - 100 ) #NEWLINE# ( segment_index , remainder ) = divmod ( segment_index , 26 ) #NEWLINE# if extension [ 0 ] . islower ( ) : #NEWLINE# #INDENT# third_letter = chr ( ( ord ( 'a' ) + remainder ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# third_letter = chr ( ( ord ( 'A' ) + remainder ) ) #NEWLINE# #UNINDENT# ( segment_index , remainder ) = divmod ( segment_index , 26 ) #NEWLINE# if extension [ 0 ] . islower ( ) : #NEWLINE# #INDENT# second_letter = chr ( ( ord ( 'a' ) + remainder ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# second_letter = chr ( ( ord ( 'A' ) + remainder ) ) #NEWLINE# #UNINDENT# first_letter = chr ( ( ord ( extension [ 0 ] ) + segment_index ) ) #NEWLINE# if ( extension [ 1 ] == 'x' ) : #NEWLINE# #INDENT# path = '/{0:s}.{1:s}x{2:s}{3:s}' . format ( filename , first_letter , second_letter , third_letter ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# path = '/{0:s}.{1:s}{2:s}{3:s}' . format ( filename , first_letter , second_letter , third_letter ) #NEWLINE# #UNINDENT# #UNINDENT# file_system . AddFileEntry ( path ) #NEWLINE# segment_file_path_specs . append ( fake_path_spec . FakePathSpec ( location = path ) ) #NEWLINE# #UNINDENT# return file_system