idx
int64
0
63k
question
stringlengths
53
5.28k
target
stringlengths
5
805
20,200
def _is_symlink ( self ) : return len ( self . dr_entries . sl_records ) > 0 or len ( self . ce_entries . sl_records ) > 0
Internal method to determine whether this Rock Ridge entry is a symlink .
20,201
def child_link_extent ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Rock Ridge extension not yet initialized' ) if self . dr_entries . cl_record is not None : return self . dr_entries . cl_record . child_log_block_num if self . ce_entries . cl_record is not None : return self ...
Get the extent of the child of this entry if it has one .
20,202
def parent_link_extent ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Rock Ridge extension not yet initialized' ) if self . dr_entries . pl_record is not None : return self . dr_entries . pl_record . parent_log_block_num if self . ce_entries . pl_record is not None : return sel...
Get the extent of the parent of this entry if it has one .
20,203
def update_ce_block ( self , block ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Rock Ridge extension not yet initialized' ) self . ce_block = block
Update the Continuation Entry block object used by this Rock Ridge Record .
20,204
def track_entry ( self , offset , length ) : newlen = offset + length - 1 for entry in self . _entries : thislen = entry . offset + entry . length - 1 overlap = range ( max ( entry . offset , offset ) , min ( thislen , newlen ) + 1 ) if overlap : raise pycdlibexception . PyCdlibInvalidISO ( 'Overlapping CE regions on t...
Track an already allocated entry in this Rock Ridge Continuation Block .
20,205
def add_entry ( self , length ) : offset = - 1 for index , entry in enumerate ( self . _entries ) : if index == 0 : if entry . offset != 0 and length <= entry . offset : offset = 0 break else : lastentry = self . _entries [ index - 1 ] lastend = lastentry . offset + lastentry . length - 1 gapsize = entry . offset - las...
Add a new entry to this Rock Ridge Continuation Block . This method attempts to find a gap that fits the new length anywhere within this Continuation Block . If successful it returns the offset at which it placed this entry . If unsuccessful it returns None .
20,206
def remove_entry ( self , offset , length ) : for index , entry in enumerate ( self . _entries ) : if entry . offset == offset and entry . length == length : del self . _entries [ index ] break else : raise pycdlibexception . PyCdlibInternalError ( 'Could not find an entry for the RR CE entry in the CE block!' )
Given an offset and length find and remove the entry in this block that corresponds .
20,207
def crc_ccitt ( data ) : crc = 0 if not have_py_3 : for x in data : crc = crc_ccitt_table [ ord ( x ) ^ ( ( crc >> 8 ) & 0xFF ) ] ^ ( ( crc << 8 ) & 0xFF00 ) else : mv = memoryview ( data ) for x in mv . tobytes ( ) : crc = crc_ccitt_table [ x ^ ( ( crc >> 8 ) & 0xFF ) ] ^ ( ( crc << 8 ) & 0xFF00 ) return crc
Calculate the CRC over a range of bytes using the CCITT polynomial .
20,208
def _ostaunicode ( src ) : if have_py_3 : bytename = src else : bytename = src . decode ( 'utf-8' ) try : enc = bytename . encode ( 'latin-1' ) encbyte = b'\x08' except ( UnicodeEncodeError , UnicodeDecodeError ) : enc = bytename . encode ( 'utf-16_be' ) encbyte = b'\x10' return encbyte + enc
Internal function to create an OSTA byte string from a source string .
20,209
def _ostaunicode_zero_pad ( src , fulllen ) : byte_src = _ostaunicode ( src ) return byte_src + b'\x00' * ( fulllen - 1 - len ( byte_src ) ) + ( struct . pack ( '=B' , len ( byte_src ) ) )
Internal function to create a zero - padded Identifier byte string from a source string .
20,210
def _compute_csum ( data ) : def identity ( x ) : return x if isinstance ( data , str ) : myord = ord elif isinstance ( data , bytes ) : myord = identity elif isinstance ( data , bytearray ) : myord = identity csum = 0 for byte in data : csum += myord ( byte ) csum -= myord ( data [ 4 ] ) csum %= 256 return csum
A method to compute a simple checksum over the given data .
20,211
def symlink_to_bytes ( symlink_target ) : symlink_data = bytearray ( ) for comp in symlink_target . split ( '/' ) : if comp == '' : symlink_data . extend ( b'\x02\x00\x00\x00' ) elif comp == '.' : symlink_data . extend ( b'\x04\x00\x00\x00' ) elif comp == '..' : symlink_data . extend ( b'\x03\x00\x00\x00' ) else : syml...
A function to generate UDF symlink data from a Unix - like path .
20,212
def set_extent_location ( self , extent ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This Volume Descriptor is not yet initialized' ) self . new_extent_loc = extent
A method to set the new location for this UDF BEA Volume Structure .
20,213
def parse ( self , data , extent ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF NSR Volume Structure already initialized' ) ( structure_type , self . standard_ident , structure_version , reserved_unused ) = struct . unpack_from ( self . FMT , data , 0 ) if structure_type != 0 : raise ...
Parse the passed in data into a UDF NSR Volume Structure .
20,214
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF NSR Volume Structure not initialized' ) return struct . pack ( self . FMT , 0 , self . standard_ident , 1 , b'\x00' * 2041 )
A method to generate the string representing this UDF NSR Volume Structure .
20,215
def new ( self , version ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF NSR Volume Structure already initialized' ) if version == 2 : self . standard_ident = b'NSR02' elif version == 3 : self . standard_ident = b'NSR03' else : raise pycdlibexception . PyCdlibInternalError ( 'Invalid N...
A method to create a new UDF NSR Volume Structure .
20,216
def extent_location ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF NSR Volume Structure not yet initialized' ) if self . new_extent_loc < 0 : return self . orig_extent_loc return self . new_extent_loc
A method to get the extent location of this UDF NSR Volume Structure .
20,217
def parse ( self , data , extent ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Tag already initialized' ) ( self . tag_ident , self . desc_version , tag_checksum , reserved , self . tag_serial_number , desc_crc , self . desc_crc_length , self . tag_location ) = struct . unpack_from (...
Parse the passed in data into a UDF Descriptor tag .
20,218
def record ( self , crc_bytes ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Descriptor Tag not initialized' ) crc_byte_len = len ( crc_bytes ) if self . desc_crc_length >= 0 : crc_byte_len = self . desc_crc_length rec = bytearray ( struct . pack ( self . FMT , self . tag_ident , ...
A method to generate the string representing this UDF Descriptor Tag .
20,219
def new ( self , tag_ident , tag_serial = 0 ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Tag already initialized' ) self . tag_ident = tag_ident self . desc_version = 2 self . tag_serial_number = tag_serial self . tag_location = 0 self . _initialized = True
A method to create a new UDF Descriptor Tag .
20,220
def parse ( self , data , extent , desc_tag ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Anchor Volume Structure already initialized' ) ( tag_unused , self . main_vd_length , self . main_vd_extent , self . reserve_vd_length , self . reserve_vd_extent ) = struct . unpack_from ( self . FM...
Parse the passed in data into a UDF Anchor Volume Structure .
20,221
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Anchor Volume Descriptor not initialized' ) rec = struct . pack ( self . FMT , b'\x00' * 16 , self . main_vd_length , self . main_vd_extent , self . reserve_vd_length , self . reserve_vd_extent ) [ 16 : ] + b'\x00' *...
A method to generate the string representing this UDF Anchor Volume Structure .
20,222
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Anchor Volume Structure already initialized' ) self . desc_tag = UDFTag ( ) self . desc_tag . new ( 2 ) self . main_vd_length = 32768 self . main_vd_extent = 0 self . reserve_vd_length = 32768 self . reserve_vd_extent = 0 s...
A method to create a new UDF Anchor Volume Structure .
20,223
def set_extent_location ( self , new_location , main_vd_extent , reserve_vd_extent ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Anchor Volume Structure not yet initialized' ) self . new_extent_loc = new_location self . desc_tag . tag_location = new_location self . main_vd_extent...
A method to set a new location for this Anchor Volume Structure .
20,224
def parse ( self , data ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Timestamp already initialized' ) ( tz , timetype , self . year , self . month , self . day , self . hour , self . minute , self . second , self . centiseconds , self . hundreds_microseconds , self . microseconds ) ...
Parse the passed in data into a UDF Timestamp .
20,225
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Timestamp not initialized' ) tmp = ( ( 1 << 16 ) - 1 ) & self . tz newtz = tmp & 0xff newtimetype = ( ( tmp >> 8 ) & 0x0f ) | ( self . timetype << 4 ) return struct . pack ( self . FMT , newtz , newtimetype , self . ...
A method to generate the string representing this UDF Timestamp .
20,226
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Timestamp already initialized' ) tm = time . time ( ) local = time . localtime ( tm ) self . tz = utils . gmtoffset_from_tm ( tm , local ) self . timetype = 1 self . year = local . tm_year self . month = local . tm_mon self...
A method to create a new UDF Timestamp .
20,227
def parse ( self , data ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Entity ID already initialized' ) ( self . flags , self . identifier , self . suffix ) = struct . unpack_from ( self . FMT , data , 0 ) self . _initialized = True
Parse the passed in data into a UDF Entity ID .
20,228
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Entity ID not initialized' ) return struct . pack ( self . FMT , self . flags , self . identifier , self . suffix )
A method to generate the string representing this UDF Entity ID .
20,229
def new ( self , flags = 0 , identifier = b'' , suffix = b'' ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Entity ID already initialized' ) if len ( identifier ) > 23 : raise pycdlibexception . PyCdlibInvalidInput ( 'UDF Entity ID identifer must be less than 23 characters' ) if len (...
A method to create a new UDF Entity ID .
20,230
def parse ( self , data , extent , desc_tag ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Primary Volume Descriptor already initialized' ) ( tag_unused , self . vol_desc_seqnum , self . desc_num , self . vol_ident , vol_seqnum , max_vol_seqnum , interchange_level , self . max_interch...
Parse the passed in data into a UDF Primary Volume Descriptor .
20,231
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Primary Volume Descriptor not initialized' ) rec = struct . pack ( self . FMT , b'\x00' * 16 , self . vol_desc_seqnum , self . desc_num , self . vol_ident , 1 , 1 , 2 , self . max_interchange_level , 1 , 1 , self . v...
A method to generate the string representing this UDF Primary Volume Descriptor .
20,232
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Primary Volume Descriptor already initialized' ) self . desc_tag = UDFTag ( ) self . desc_tag . new ( 1 ) self . vol_desc_seqnum = 0 self . desc_num = 0 self . vol_ident = _ostaunicode_zero_pad ( 'CDROM' , 32 ) unique = for...
A method to create a new UDF Primary Volume Descriptor .
20,233
def parse ( self , data ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Implementation Use Volume Descriptor Implementation Use field already initialized' ) ( self . char_set , self . log_vol_ident , self . lv_info1 , self . lv_info2 , self . lv_info3 , impl_ident , self . impl_use ) =...
Parse the passed in data into a UDF Implementation Use Volume Descriptor Implementation Use field .
20,234
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Implementation Use Volume Descriptor Implementation Use field not initialized' ) return struct . pack ( self . FMT , self . char_set , self . log_vol_ident , self . lv_info1 , self . lv_info2 , self . lv_info3 , self...
A method to generate the string representing this UDF Implementation Use Volume Descriptor Implementation Use field .
20,235
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Implementation Use Volume Descriptor Implementation Use field already initialized' ) self . char_set = _unicodecharset ( ) self . log_vol_ident = _ostaunicode_zero_pad ( 'CDROM' , 128 ) self . lv_info1 = b'\x00' * 36 self ....
A method to create a new UDF Implementation Use Volume Descriptor Implementation Use field .
20,236
def parse ( self , data , extent , desc_tag ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Implementation Use Volume Descriptor already initialized' ) ( tag_unused , self . vol_desc_seqnum , impl_ident , impl_use ) = struct . unpack_from ( self . FMT , data , 0 ) self . desc_tag = des...
Parse the passed in data into a UDF Implementation Use Volume Descriptor .
20,237
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Implementation Use Volume Descriptor already initialized' ) self . desc_tag = UDFTag ( ) self . desc_tag . new ( 4 ) self . vol_desc_seqnum = 1 self . impl_ident = UDFEntityID ( ) self . impl_ident . new ( 0 , b'*UDF LV Inf...
A method to create a new UDF Implementation Use Volume Descriptor .
20,238
def parse ( self , data ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Partition Header Descriptor already initialized' ) ( unalloc_table_length , unalloc_table_pos , unalloc_bitmap_length , unalloc_bitmap_pos , part_integrity_table_length , part_integrity_table_pos , freed_table_leng...
Parse the passed in data into a UDF Partition Header Descriptor .
20,239
def parse ( self , data , extent , desc_tag ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Partition Volume Descriptor already initialized' ) ( tag_unused , self . vol_desc_seqnum , self . part_flags , self . part_num , part_contents , part_contents_use , self . access_type , self . p...
Parse the passed in data into a UDF Partition Volume Descriptor .
20,240
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Partition Volume Descriptor not initialized' ) rec = struct . pack ( self . FMT , b'\x00' * 16 , self . vol_desc_seqnum , self . part_flags , self . part_num , self . part_contents . record ( ) , self . part_contents...
A method to generate the string representing this UDF Partition Volume Descriptor .
20,241
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Partition Volume Descriptor already initialized' ) self . desc_tag = UDFTag ( ) self . desc_tag . new ( 5 ) self . vol_desc_seqnum = 2 self . part_flags = 1 self . part_num = 0 self . part_contents = UDFEntityID ( ) self . ...
A method to create a new UDF Partition Volume Descriptor .
20,242
def set_start_location ( self , new_location ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Partition Volume Descriptor not initialized' ) self . part_start_location = new_location
A method to set the location of the start of the partition .
20,243
def parse ( self , data ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Partition Map already initialized' ) ( map_type , map_length , vol_seqnum , self . part_num ) = struct . unpack_from ( self . FMT , data , 0 ) if map_type != 1 : raise pycdlibexception . PyCdlibInvalidISO ( 'UDF Pa...
Parse the passed in data into a UDF Partition Map .
20,244
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Partition Map already initialized' ) self . part_num = 0 self . _initialized = True
A method to create a new UDF Partition Map .
20,245
def parse ( self , data ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Long Allocation descriptor already initialized' ) ( self . extent_length , self . log_block_num , self . part_ref_num , self . impl_use ) = struct . unpack_from ( self . FMT , data , 0 ) self . _initialized = True
Parse the passed in data into a UDF Long AD .
20,246
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Long AD not initialized' ) return struct . pack ( self . FMT , self . extent_length , self . log_block_num , self . part_ref_num , self . impl_use )
A method to generate the string representing this UDF Long AD .
20,247
def new ( self , length , blocknum ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Long AD already initialized' ) self . extent_length = length self . log_block_num = blocknum self . part_ref_num = 0 self . impl_use = b'\x00' * 6 self . _initialized = True
A method to create a new UDF Long AD .
20,248
def set_extent_location ( self , new_location , tag_location ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Long AD not initialized' ) self . log_block_num = tag_location self . impl_use = b'\x00\x00' + struct . pack ( '=L' , new_location )
A method to set the location fields of this UDF Long AD .
20,249
def parse ( self , data , extent , desc_tag ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Logical Volume Descriptor already initialized' ) ( tag_unused , self . vol_desc_seqnum , self . desc_char_set , self . logical_vol_ident , logical_block_size , domain_ident , logical_volume_cont...
Parse the passed in data into a UDF Logical Volume Descriptor .
20,250
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Logical Volume Descriptor not initialized' ) rec = struct . pack ( self . FMT , b'\x00' * 16 , self . vol_desc_seqnum , self . desc_char_set , self . logical_vol_ident , 2048 , self . domain_ident . record ( ) , self...
A method to generate the string representing this UDF Logical Volume Descriptor .
20,251
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Logical Volume Descriptor already initialized' ) self . desc_tag = UDFTag ( ) self . desc_tag . new ( 6 ) self . vol_desc_seqnum = 3 self . desc_char_set = _unicodecharset ( ) self . logical_vol_ident = _ostaunicode_zero_pa...
A method to create a new UDF Logical Volume Descriptor .
20,252
def set_integrity_location ( self , integrity_extent ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Logical Volume Descriptor not initialized' ) self . integrity_sequence_extent = integrity_extent
A method to set the location of the UDF Integrity sequence that this descriptor references .
20,253
def parse ( self , data , extent , desc_tag ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Unallocated Space Descriptor already initialized' ) ( tag_unused , self . vol_desc_seqnum , num_alloc_descriptors , end_unused ) = struct . unpack_from ( self . FMT , data , 0 ) self . desc_tag ...
Parse the passed in data into a UDF Unallocated Space Descriptor .
20,254
def parse ( self , extent , desc_tag ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Terminating Descriptor already initialized' ) self . desc_tag = desc_tag self . orig_extent_loc = extent self . _initialized = True
Parse the passed in data into a UDF Terminating Descriptor .
20,255
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Terminating Descriptor not initialized' ) rec = struct . pack ( self . FMT , b'\x00' * 16 , b'\x00' * 496 ) [ 16 : ] return self . desc_tag . record ( rec ) + rec
A method to generate the string representing this UDF Terminating Descriptor .
20,256
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Terminating Descriptor already initialized' ) self . desc_tag = UDFTag ( ) self . desc_tag . new ( 8 ) self . _initialized = True
A method to create a new UDF Terminating Descriptor .
20,257
def set_extent_location ( self , new_location , tag_location = None ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Terminating Descriptor not initialized' ) self . new_extent_loc = new_location if tag_location is None : tag_location = new_location self . desc_tag . tag_location = ...
A method to set the location of this UDF Terminating Descriptor .
20,258
def parse ( self , data ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Logical Volume Header Descriptor already initialized' ) ( self . unique_id , reserved_unused ) = struct . unpack_from ( self . FMT , data , 0 ) self . _initialized = True
Parse the passed in data into a UDF Logical Volume Header Descriptor .
20,259
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Logical Volume Header Descriptor already initialized' ) self . unique_id = 261 self . _initialized = True
A method to create a new UDF Logical Volume Header Descriptor .
20,260
def parse ( self , data ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Logical Volume Implementation Use already initialized' ) ( impl_id , self . num_files , self . num_dirs , self . min_udf_read_revision , self . min_udf_write_revision , self . max_udf_write_revision ) = struct . un...
Parse the passed in data into a UDF Logical Volume Implementation Use .
20,261
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Logical Volume Implementation Use not initialized' ) return struct . pack ( self . FMT , self . impl_id . record ( ) , self . num_files , self . num_dirs , self . min_udf_read_revision , self . min_udf_write_revision...
A method to generate the string representing this UDF Logical Volume Implementation Use .
20,262
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Logical Volume Implementation Use already initialized' ) self . impl_id = UDFEntityID ( ) self . impl_id . new ( 0 , b'*pycdlib' ) self . num_files = 0 self . num_dirs = 1 self . min_udf_read_revision = 258 self . min_udf_w...
A method to create a new UDF Logical Volume Implementation Use .
20,263
def parse ( self , data , extent , desc_tag ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Logical Volume Integrity Descriptor already initialized' ) ( tag_unused , recording_date , integrity_type , next_integrity_extent_length , next_integrity_extent_extent , logical_volume_contents_...
Parse the passed in data into a UDF Logical Volume Integrity Descriptor .
20,264
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Logical Volume Integrity Descriptor not initialized' ) rec = struct . pack ( self . FMT , b'\x00' * 16 , self . recording_date . record ( ) , 1 , 0 , 0 , self . logical_volume_contents_use . record ( ) , 1 , self . l...
A method to generate the string representing this UDF Logical Volume Integrity Descriptor .
20,265
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF Logical Volume Integrity Descriptor already initialized' ) self . desc_tag = UDFTag ( ) self . desc_tag . new ( 9 ) self . recording_date = UDFTimestamp ( ) self . recording_date . new ( ) self . length_impl_use = 46 self ....
A method to create a new UDF Logical Volume Integrity Descriptor .
20,266
def parse ( self , data , extent , desc_tag ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF File Set Descriptor already initialized' ) ( tag_unused , recording_date , interchange_level , max_interchange_level , char_set_list , max_char_set_list , self . file_set_num , file_set_desc_num...
Parse the passed in data into a UDF File Set Descriptor .
20,267
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF File Set Descriptor not initialized' ) rec = struct . pack ( self . FMT , b'\x00' * 16 , self . recording_date . record ( ) , 3 , 3 , 1 , 1 , self . file_set_num , 0 , self . log_vol_char_set , self . log_vol_ident ,...
A method to generate the string representing this UDF File Set Descriptor .
20,268
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF File Set Descriptor already initialized' ) self . desc_tag = UDFTag ( ) self . desc_tag . new ( 256 ) self . recording_date = UDFTimestamp ( ) self . recording_date . new ( ) self . domain_ident = UDFEntityID ( ) self . dom...
A method to create a new UDF File Set Descriptor .
20,269
def set_extent_location ( self , new_location ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF File Set Descriptor not initialized' ) self . new_extent_loc = new_location
A method to set the location of this UDF File Set Descriptor .
20,270
def parse ( self , data ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF ICB Tag already initialized' ) ( self . prior_num_direct_entries , self . strategy_type , self . strategy_param , self . max_num_entries , reserved , self . file_type , self . parent_icb_log_block_num , self . pare...
Parse the passed in data into a UDF ICB Tag .
20,271
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF ICB Tag not initialized' ) return struct . pack ( self . FMT , self . prior_num_direct_entries , self . strategy_type , self . strategy_param , self . max_num_entries , 0 , self . file_type , self . parent_icb_log_bl...
A method to generate the string representing this UDF ICB Tag .
20,272
def new ( self , file_type ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF ICB Tag already initialized' ) self . prior_num_direct_entries = 0 self . strategy_type = 4 self . strategy_param = 0 self . max_num_entries = 1 if file_type == 'dir' : self . file_type = 4 elif file_type == 'fi...
A method to create a new UDF ICB Tag .
20,273
def parse ( self , data , extent , parent , desc_tag ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF File Entry already initialized' ) ( tag_unused , icb_tag , self . uid , self . gid , self . perms , self . file_link_count , record_format , record_display_attrs , record_len , self . i...
Parse the passed in data into a UDF File Entry .
20,274
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF File Entry not initialized' ) rec = struct . pack ( self . FMT , b'\x00' * 16 , self . icb_tag . record ( ) , self . uid , self . gid , self . perms , self . file_link_count , 0 , 0 , 0 , self . info_len , self . log...
A method to generate the string representing this UDF File Entry .
20,275
def new ( self , length , file_type , parent , log_block_size ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF File Entry already initialized' ) if file_type not in ( 'dir' , 'file' , 'symlink' ) : raise pycdlibexception . PyCdlibInternalError ( "UDF File Entry file type must be one of ...
A method to create a new UDF File Entry .
20,276
def add_file_ident_desc ( self , new_fi_desc , logical_block_size ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF File Entry not initialized' ) if self . icb_tag . file_type != 4 : raise pycdlibexception . PyCdlibInvalidInput ( 'Can only add a UDF File Identifier to a directory' ) ...
A method to add a new UDF File Identifier Descriptor to this UDF File Entry .
20,277
def remove_file_ident_desc_by_name ( self , name , logical_block_size ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF File Entry not initialized' ) tmp_fi_desc = UDFFileIdentifierDescriptor ( ) tmp_fi_desc . isparent = False tmp_fi_desc . fi = name desc_index = len ( self . fi_desc...
A method to remove a UDF File Identifier Descriptor from this UDF File Entry .
20,278
def set_data_location ( self , current_extent , start_extent ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF File Entry not initialized' ) current_assignment = start_extent for index , desc_unused in enumerate ( self . alloc_descs ) : self . alloc_descs [ index ] [ 1 ] = current_as...
A method to set the location of the data that this UDF File Entry points to .
20,279
def set_data_length ( self , length ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record not yet initialized' ) len_diff = length - self . info_len if len_diff > 0 : new_len = self . alloc_descs [ - 1 ] [ 0 ] + len_diff if new_len > 0x3ffff800 : raise pycdlibexception . PyC...
A method to set the length of the data that this UDF File Entry points to .
20,280
def file_identifier ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF File Entry not initialized' ) if self . file_ident is None : return b'/' return self . file_ident . fi
A method to get the name of this UDF File Entry as a byte string .
20,281
def find_file_ident_desc_by_name ( self , currpath ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF File Entry not initialized' ) if self . icb_tag . file_type != 4 or not self . fi_descs : raise pycdlibexception . PyCdlibInvalidInput ( 'Could not find path' ) tmp = currpath . decod...
A method to find a UDF File Identifier descriptor by its name .
20,282
def track_file_ident_desc ( self , file_ident ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF File Entry not initialized' ) self . fi_descs . append ( file_ident )
A method to start tracking a UDF File Identifier descriptor in this UDF File Entry . Both tracking and addition add the identifier to the list of file identifiers but tracking doees not expand or otherwise modify the UDF File Entry .
20,283
def finish_directory_parse ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF File Entry not initialized' ) if self . icb_tag . file_type != 4 : raise pycdlibexception . PyCdlibInternalError ( 'Can only finish_directory for a directory' )
A method to finish up the parsing of this UDF File Entry directory . In particular this method checks to see if it is in sorted order for future use .
20,284
def length ( cls , namelen ) : if namelen > 0 : namelen += 1 to_add = struct . calcsize ( cls . FMT ) + namelen return to_add + UDFFileIdentifierDescriptor . pad ( to_add )
A class method to calculate the size this UDFFileIdentifierDescriptor would take up .
20,285
def parse ( self , data , extent , desc_tag , parent ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF File Identifier Descriptor already initialized' ) ( tag_unused , file_version_num , self . file_characteristics , self . len_fi , icb , self . len_impl_use ) = struct . unpack_from ( se...
Parse the passed in data into a UDF File Identifier Descriptor .
20,286
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF File Identifier Descriptor not initialized' ) if self . len_fi > 0 : if self . encoding == 'latin-1' : prefix = b'\x08' elif self . encoding == 'utf-16_be' : prefix = b'\x10' else : raise pycdlibexception . PyCdlibIn...
A method to generate the string representing this UDF File Identifier Descriptor .
20,287
def new ( self , isdir , isparent , name , parent ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF File Identifier already initialized' ) self . desc_tag = UDFTag ( ) self . desc_tag . new ( 257 ) self . icb = UDFLongAD ( ) self . icb . new ( 2048 , 2 ) self . isdir = isdir self . ispar...
A method to create a new UDF File Identifier .
20,288
def set_icb ( self , new_location , tag_location ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'UDF File Identifier not initialized' ) self . icb . set_extent_location ( new_location , tag_location )
A method to set the location of the data that this UDF File Identifier Descriptor points at . The data can either be for a directory or for a file .
20,289
def pvd_factory ( sys_ident , vol_ident , set_size , seqnum , log_block_size , vol_set_ident , pub_ident_str , preparer_ident_str , app_ident_str , copyright_file , abstract_file , bibli_file , vol_expire_date , app_use , xa ) : pvd = PrimaryOrSupplementaryVD ( VOLUME_DESCRIPTOR_TYPE_PRIMARY ) pvd . new ( 0 , sys_ident...
An internal function to create a Primary Volume Descriptor .
20,290
def enhanced_vd_factory ( sys_ident , vol_ident , set_size , seqnum , log_block_size , vol_set_ident , pub_ident_str , preparer_ident_str , app_ident_str , copyright_file , abstract_file , bibli_file , vol_expire_date , app_use , xa ) : svd = PrimaryOrSupplementaryVD ( VOLUME_DESCRIPTOR_TYPE_SUPPLEMENTARY ) svd . new (...
An internal function to create an Enhanced Volume Descriptor for ISO 1999 .
20,291
def joliet_vd_factory ( joliet , sys_ident , vol_ident , set_size , seqnum , log_block_size , vol_set_ident , pub_ident_str , preparer_ident_str , app_ident_str , copyright_file , abstract_file , bibli_file , vol_expire_date , app_use , xa ) : if joliet == 1 : escape_sequence = b'%/@' elif joliet == 2 : escape_sequence...
An internal function to create an Joliet Volume Descriptor .
20,292
def copy ( self , orig ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This Volume Descriptor is already initialized' ) self . version = orig . version self . flags = orig . flags self . system_identifier = orig . system_identifier self . volume_identifier = orig . volume_identifier self ....
A method to populate and initialize this VD object from the contents of an old VD .
20,293
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This Volume Descriptor is not yet initialized' ) vol_mod_date = dates . VolumeDescriptorDate ( ) vol_mod_date . new ( time . time ( ) ) return struct . pack ( self . FMT , self . _vd_type , b'CD001' , self . version , se...
A method to generate the string representing this Volume Descriptor .
20,294
def track_rr_ce_entry ( self , extent , offset , length ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This Primary Volume Descriptor is not yet initialized' ) for block in self . rr_ce_blocks : if block . extent_location ( ) == extent : break else : block = rockridge . RockRidgeConti...
Start tracking a new Rock Ridge Continuation Entry entry in this Volume Descriptor at the extent offset and length provided . Since Rock Ridge Continuation Blocks are shared across multiple Rock Ridge Directory Records the most logical place to track them is in the PVD . This method is expected to be used during parse ...
20,295
def clear_rr_ce_entries ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This Primary Volume Descriptor is not yet initialized' ) for block in self . rr_ce_blocks : block . set_extent_location ( - 1 )
A method to clear out all of the extent locations of all Rock Ridge Continuation Entries that the PVD is tracking . This can be used to reset all data before assigning new data .
20,296
def add_to_space_size ( self , addition_bytes ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This Volume Descriptor is not yet initialized' ) self . space_size += utils . ceiling_div ( addition_bytes , self . log_block_size )
A method to add bytes to the space size tracked by this Volume Descriptor .
20,297
def remove_from_space_size ( self , removal_bytes ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This Volume Descriptor is not yet initialized' ) self . space_size -= utils . ceiling_div ( removal_bytes , self . log_block_size )
Remove bytes from the volume descriptor .
20,298
def add_to_ptr_size ( self , ptr_size ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This Volume Descriptor is not yet initialized' ) self . path_tbl_size += ptr_size if ( utils . ceiling_div ( self . path_tbl_size , 4096 ) * 2 ) > self . path_table_num_extents : self . path_table_num...
Add the space for a path table record to the volume descriptor .
20,299
def remove_from_ptr_size ( self , ptr_size ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This Volume Descriptor is not yet initialized' ) self . path_tbl_size -= ptr_size new_extents = utils . ceiling_div ( self . path_tbl_size , 4096 ) * 2 need_remove_extents = False if new_extents ...
Remove the space for a path table record from the volume descriptor .