idx
int64
0
63k
question
stringlengths
53
5.28k
target
stringlengths
5
805
20,100
def file_object_supports_binary ( fp ) : if hasattr ( fp , 'mode' ) : return 'b' in fp . mode if sys . version_info >= ( 3 , 0 ) : return isinstance ( fp , ( io . RawIOBase , io . BufferedIOBase ) ) return isinstance ( fp , ( cStringIO . OutputType , cStringIO . InputType , io . RawIOBase , io . BufferedIOBase ) )
A function to check whether a file - like object supports binary mode .
20,101
def parse ( self , instr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This IsoHybrid object is already initialized' ) if len ( instr ) != 512 : raise pycdlibexception . PyCdlibInvalidISO ( 'Invalid size of the instr' ) if instr [ 0 : 32 ] == self . ORIG_HEADER : self . header = self . O...
A method to parse ISO hybridization info out of an existing ISO .
20,102
def new ( self , mac , part_entry , mbr_id , part_offset , geometry_sectors , geometry_heads , part_type ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This IsoHybrid object is already initialized' ) if mac : self . header = self . MAC_AFP else : self . header = self . ORIG_HEADER isohybr...
A method to add ISO hybridization to an ISO .
20,103
def _calc_cc ( self , iso_size ) : cylsize = self . geometry_heads * self . geometry_sectors * 512 frac = iso_size % cylsize padding = 0 if frac > 0 : padding = cylsize - frac cc = ( iso_size + padding ) // cylsize if cc > 1024 : cc = 1024 return ( cc , padding )
A method to calculate the cc and the padding values for this hybridization .
20,104
def record ( self , iso_size ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This IsoHybrid object is not yet initialized' ) outlist = [ struct . pack ( '=32s400sLLLH' , self . header , self . mbr , self . rba , 0 , self . mbr_id , 0 ) ] for i in range ( 1 , 5 ) : if i == self . part_e...
A method to generate a string containing the ISO hybridization .
20,105
def record_padding ( self , iso_size ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This IsoHybrid object is not yet initialized' ) return b'\x00' * self . _calc_cc ( iso_size ) [ 1 ]
A method to record padding for the ISO hybridization .
20,106
def update_rba ( self , current_extent ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This IsoHybrid object is not yet initialized' ) self . rba = current_extent
A method to update the current rba for the ISO hybridization .
20,107
def parse ( self , xastr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This XARecord is already initialized!' ) ( self . _group_id , self . _user_id , self . _attributes , signature , self . _filenum , unused ) = struct . unpack_from ( self . FMT , xastr , 0 ) if signature != b'XA' : rai...
Parse an Extended Attribute Record out of a string .
20,108
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This XARecord is already initialized!' ) self . _group_id = 0 self . _user_id = 0 self . _attributes = 0 self . _filenum = 0 self . _initialized = True
Create a new Extended Attribute Record .
20,109
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This XARecord is not yet initialized!' ) return struct . pack ( self . FMT , self . _group_id , self . _user_id , self . _attributes , b'XA' , self . _filenum , b'\x00' * 5 )
Record this Extended Attribute Record .
20,110
def _new ( self , vd , name , parent , seqnum , isdir , length , xa ) : self . date = dates . DirectoryRecordDate ( ) self . date . new ( ) if length > 2 ** 32 - 1 : raise pycdlibexception . PyCdlibInvalidInput ( 'Maximum supported file length is 2^32-1' ) self . data_length = length self . file_ident = name self . isd...
Internal method to create a new Directory Record .
20,111
def new_symlink ( self , vd , name , parent , rr_target , seqnum , rock_ridge , rr_name , xa ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record already initialized' ) self . _new ( vd , name , parent , seqnum , False , 0 , xa ) if rock_ridge : self . _rr_new ( rock_ridge , rr...
Create a new symlink Directory Record . This implies that the new record will be Rock Ridge .
20,112
def new_file ( self , vd , length , isoname , parent , seqnum , rock_ridge , rr_name , xa , file_mode ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record already initialized' ) self . _new ( vd , isoname , parent , seqnum , False , length , xa ) if rock_ridge : self . _rr_new ...
Create a new file Directory Record .
20,113
def new_root ( self , vd , seqnum , log_block_size ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record already initialized' ) self . _new ( vd , b'\x00' , None , seqnum , True , log_block_size , False )
Create a new root Directory Record .
20,114
def new_dot ( self , vd , parent , seqnum , rock_ridge , log_block_size , xa , file_mode ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record already initialized' ) self . _new ( vd , b'\x00' , parent , seqnum , True , log_block_size , xa ) if rock_ridge : self . _rr_new ( rock...
Create a new dot Directory Record .
20,115
def new_dotdot ( self , vd , parent , seqnum , rock_ridge , log_block_size , rr_relocated_parent , xa , file_mode ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record already initialized' ) self . _new ( vd , b'\x01' , parent , seqnum , True , log_block_size , xa ) if rock_ridg...
Create a new dotdot Directory Record .
20,116
def new_dir ( self , vd , name , parent , seqnum , rock_ridge , rr_name , log_block_size , rr_relocated_child , rr_relocated , xa , file_mode ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record already initialized' ) self . _new ( vd , name , parent , seqnum , True , log_block...
Create a new directory Directory Record .
20,117
def change_existence ( self , is_hidden ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record not yet initialized' ) if is_hidden : self . file_flags |= ( 1 << self . FILE_FLAG_EXISTENCE_BIT ) else : self . file_flags &= ~ ( 1 << self . FILE_FLAG_EXISTENCE_BIT )
Change the ISO9660 existence flag of this Directory Record .
20,118
def _recalculate_extents_and_offsets ( self , index , logical_block_size ) : if index == 0 : dirrecord_offset = 0 num_extents = 1 else : dirrecord_offset = self . children [ index - 1 ] . offset_to_here num_extents = self . children [ index - 1 ] . extents_to_here for i in range ( index , len ( self . children ) ) : c ...
Internal method to recalculate the extents and offsets associated with children of this directory record .
20,119
def _add_child ( self , child , logical_block_size , allow_duplicate , check_overflow ) : if not self . isdir : raise pycdlibexception . PyCdlibInvalidInput ( 'Trying to add a child to a record that is not a directory' ) index = bisect . bisect_left ( self . children , child ) if index != len ( self . children ) and se...
An internal method to add a child to this object . Note that this is called both during parsing and when adding a new object to the system so it it shouldn t have any functionality that is not appropriate for both .
20,120
def add_child ( self , child , logical_block_size , allow_duplicate = False ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record not yet initialized' ) return self . _add_child ( child , logical_block_size , allow_duplicate , True )
A method to add a new child to this directory record .
20,121
def track_child ( self , child , logical_block_size , allow_duplicate = False ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record not yet initialized' ) self . _add_child ( child , logical_block_size , allow_duplicate , False )
A method to track an existing child of this directory record .
20,122
def remove_child ( self , child , index , logical_block_size ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record not yet initialized' ) if index < 0 : raise pycdlibexception . PyCdlibInternalError ( 'Invalid child index to remove' ) if child . rock_ridge is not None : if c...
A method to remove a child from this Directory Record .
20,123
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record not yet initialized' ) self . date = dates . DirectoryRecordDate ( ) self . date . new ( ) padlen = struct . calcsize ( self . FMT ) + self . len_fi padstr = b'\x00' * ( padlen % 2 ) extent_loc = self . ...
A method to generate the string representing this Directory Record .
20,124
def is_associated_file ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record not yet initialized' ) return self . file_flags & ( 1 << self . FILE_FLAG_ASSOCIATED_FILE_BIT )
A method to determine whether this file is associated with another file on the ISO .
20,125
def set_ptr ( self , ptr ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record not yet initialized' ) self . ptr = ptr
A method to set the Path Table Record associated with this Directory Record .
20,126
def set_data_location ( self , current_extent , tag_location ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record not yet initialized' ) self . new_extent_loc = current_extent if self . ptr is not None : self . ptr . update_extent_location ( current_extent )
A method to set the new extent location that the data for this Directory Record should live at .
20,127
def get_data_length ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record not yet initialized' ) if self . inode is not None : return self . inode . get_data_length ( ) return self . data_length
A method to get the length of the data that this Directory Record points to .
20,128
def set_data_length ( self , length ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record not yet initialized' ) self . data_length = length
A method to set the length of the data that this Directory Record points to .
20,129
def new ( self , length , fp , manage_fp , offset ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Inode is already initialized' ) self . data_length = length self . data_fp = fp self . manage_fp = manage_fp self . fp_offset = offset self . original_data_location = self . DATA_IN_EXTERNAL_F...
Initialize a new Inode .
20,130
def parse ( self , extent , length , fp , log_block_size ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Inode is already initialized' ) self . orig_extent_loc = extent self . data_length = length self . data_fp = fp self . manage_fp = False self . fp_offset = extent * log_block_size self ...
Parse an existing Inode . This just saves off the extent for later use .
20,131
def add_boot_info_table ( self , boot_info_table ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Inode is not yet initialized' ) self . boot_info_table = boot_info_table
A method to add a boot info table to this Inode .
20,132
def update_fp ( self , fp , length ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Inode is not yet initialized' ) self . original_data_location = self . DATA_IN_EXTERNAL_FP self . data_fp = fp self . data_length = length self . fp_offset = 0
Update the Inode to use a different file object and length .
20,133
def string_to_timestruct ( input_string ) : try : timestruct = time . strptime ( input_string . decode ( 'utf-8' ) , VolumeDescriptorDate . TIME_FMT ) except ValueError : timestruct = time . struct_time ( ( 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ) ) return timestruct
A cacheable function to take an input string and decode it into a time . struct_time from the time module . If the string cannot be decoded because of an illegal value then the all - zero time . struct_time will be returned instead .
20,134
def parse ( self , datestr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record Date already initialized' ) ( self . years_since_1900 , self . month , self . day_of_month , self . hour , self . minute , self . second , self . gmtoffset ) = struct . unpack_from ( self . FMT , da...
Parse a Directory Record date out of a string .
20,135
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record Date already initialized' ) tm = time . time ( ) local = time . localtime ( tm ) self . years_since_1900 = local . tm_year - 1900 self . month = local . tm_mon self . day_of_month = local . tm_mday self . hour ...
Create a new Directory Record date based on the current time .
20,136
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Directory Record Date not initialized' ) return struct . pack ( self . FMT , self . years_since_1900 , self . month , self . day_of_month , self . hour , self . minute , self . second , self . gmtoffset )
Return a string representation of the Directory Record date .
20,137
def parse ( self , datestr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This Volume Descriptor Date object is already initialized' ) if len ( datestr ) != 17 : raise pycdlibexception . PyCdlibInvalidISO ( 'Invalid ISO9660 date string' ) timestruct = string_to_timestruct ( datestr [ : - ...
Parse a Volume Descriptor Date out of a string . A string of all zeros is valid which means that the date in this field was not specified .
20,138
def parse ( self , rrstr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'SP record already initialized!' ) ( su_len , su_entry_version_unused , check_byte1 , check_byte2 , self . bytes_to_skip ) = struct . unpack_from ( '=BBBBB' , rrstr [ : 7 ] , 2 ) if su_len != RRSPRecord . length ( ) : ...
Parse a Rock Ridge Sharing Protocol record out of a string .
20,139
def new ( self , bytes_to_skip ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'SP record already initialized!' ) self . bytes_to_skip = bytes_to_skip self . _initialized = True
Create a new Rock Ridge Sharing Protocol record .
20,140
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'SP record not yet initialized!' ) return b'SP' + struct . pack ( '=BBBBB' , RRSPRecord . length ( ) , SU_ENTRY_VERSION , 0xbe , 0xef , self . bytes_to_skip )
Generate a string representing the Rock Ridge Sharing Protocol record .
20,141
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'RR record already initialized!' ) self . rr_flags = 0 self . _initialized = True
Create a new Rock Ridge Rock Ridge record .
20,142
def append_field ( self , fieldname ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'RR record not yet initialized!' ) if fieldname == 'PX' : bit = 0 elif fieldname == 'PN' : bit = 1 elif fieldname == 'SL' : bit = 2 elif fieldname == 'NM' : bit = 3 elif fieldname == 'CL' : bit = 4 elif ...
Mark a field as present in the Rock Ridge records .
20,143
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'RR record not yet initialized!' ) return b'RR' + struct . pack ( '=BBB' , RRRRRecord . length ( ) , SU_ENTRY_VERSION , self . rr_flags )
Generate a string representing the Rock Ridge Rock Ridge record .
20,144
def parse ( self , rrstr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'CE record already initialized!' ) ( su_len , su_entry_version_unused , bl_cont_area_le , bl_cont_area_be , offset_cont_area_le , offset_cont_area_be , len_cont_area_le , len_cont_area_be ) = struct . unpack_from ( '=B...
Parse a Rock Ridge Continuation Entry record out of a string .
20,145
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'CE record already initialized!' ) self . bl_cont_area = 0 self . offset_cont_area = 0 self . len_cont_area = 0 self . _initialized = True
Create a new Rock Ridge Continuation Entry record .
20,146
def update_extent ( self , extent ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'CE record not yet initialized!' ) self . bl_cont_area = extent
Update the extent for this CE record .
20,147
def update_offset ( self , offset ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'CE record not yet initialized!' ) self . offset_cont_area = offset
Update the offset for this CE record .
20,148
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'CE record not yet initialized!' ) return b'CE' + struct . pack ( '=BBLLLLLL' , RRCERecord . length ( ) , SU_ENTRY_VERSION , self . bl_cont_area , utils . swab_32bit ( self . bl_cont_area ) , self . offset_cont_area , uti...
Generate a string representing the Rock Ridge Continuation Entry record .
20,149
def parse ( self , rrstr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'PX record already initialized!' ) ( su_len , su_entry_version_unused , posix_file_mode_le , posix_file_mode_be , posix_file_links_le , posix_file_links_be , posix_file_user_id_le , posix_file_user_id_be , posix_file_g...
Parse a Rock Ridge POSIX File Attributes record out of a string .
20,150
def new ( self , mode ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'PX record already initialized!' ) self . posix_file_mode = mode self . posix_file_links = 1 self . posix_user_id = 0 self . posix_group_id = 0 self . posix_serial_number = 0 self . _initialized = True
Create a new Rock Ridge POSIX File Attributes record .
20,151
def record ( self , rr_version ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'PX record not yet initialized!' ) outlist = [ b'PX' , struct . pack ( '=BBLLLLLLLL' , RRPXRecord . length ( rr_version ) , SU_ENTRY_VERSION , self . posix_file_mode , utils . swab_32bit ( self . posix_file_m...
Generate a string representing the Rock Ridge POSIX File Attributes record .
20,152
def parse ( self , rrstr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'ER record already initialized!' ) ( su_len , su_entry_version_unused , len_id , len_des , len_src , self . ext_ver ) = struct . unpack_from ( '=BBBBBB' , rrstr [ : 8 ] , 2 ) if su_len > len ( rrstr ) : raise pycdlibex...
Parse a Rock Ridge Extensions Reference record out of a string .
20,153
def new ( self , ext_id , ext_des , ext_src ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'ER record already initialized!' ) self . ext_id = ext_id self . ext_des = ext_des self . ext_src = ext_src self . ext_ver = 1 self . _initialized = True
Create a new Rock Ridge Extensions Reference record .
20,154
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'ER record not yet initialized!' ) return b'ER' + struct . pack ( '=BBBBBB' , RRERRecord . length ( self . ext_id , self . ext_des , self . ext_src ) , SU_ENTRY_VERSION , len ( self . ext_id ) , len ( self . ext_des ) , l...
Generate a string representing the Rock Ridge Extensions Reference record .
20,155
def length ( ext_id , ext_des , ext_src ) : return 8 + len ( ext_id ) + len ( ext_des ) + len ( ext_src )
Static method to return the length of the Rock Ridge Extensions Reference record .
20,156
def new ( self , extension_sequence ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'ES record already initialized!' ) self . extension_sequence = extension_sequence self . _initialized = True
Create a new Rock Ridge Extension Selector record .
20,157
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'ES record not yet initialized!' ) return b'ES' + struct . pack ( '=BBB' , RRESRecord . length ( ) , SU_ENTRY_VERSION , self . extension_sequence )
Generate a string representing the Rock Ridge Extension Selector record .
20,158
def parse ( self , rrstr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'PN record already initialized!' ) ( su_len , su_entry_version_unused , dev_t_high_le , dev_t_high_be , dev_t_low_le , dev_t_low_be ) = struct . unpack_from ( '=BBLLLL' , rrstr [ : 20 ] , 2 ) if su_len != RRPNRecord . ...
Parse a Rock Ridge POSIX Device Number record out of a string .
20,159
def new ( self , dev_t_high , dev_t_low ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'PN record already initialized!' ) self . dev_t_high = dev_t_high self . dev_t_low = dev_t_low self . _initialized = True
Create a new Rock Ridge POSIX device number record .
20,160
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'PN record not yet initialized!' ) return b'PN' + struct . pack ( '=BBLLLL' , RRPNRecord . length ( ) , SU_ENTRY_VERSION , self . dev_t_high , utils . swab_32bit ( self . dev_t_high ) , self . dev_t_low , utils . swab_32b...
Generate a string representing the Rock Ridge POSIX Device Number record .
20,161
def parse ( self , rrstr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'SL record already initialized!' ) ( su_len , su_entry_version_unused , self . flags ) = struct . unpack_from ( '=BBB' , rrstr [ : 5 ] , 2 ) cr_offset = 5 data_len = su_len - 5 while data_len > 0 : ( cr_flags , len_cp ...
Parse a Rock Ridge Symbolic Link record out of a string .
20,162
def add_component ( self , symlink_comp ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'SL record not yet initialized!' ) if ( self . current_length ( ) + RRSLRecord . Component . length ( symlink_comp ) ) > 255 : raise pycdlibexception . PyCdlibInvalidInput ( 'Symlink would be longer ...
Add a new component to this symlink record .
20,163
def current_length ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'SL record not yet initialized!' ) strlist = [ ] for comp in self . symlink_components : strlist . append ( comp . name ( ) ) return RRSLRecord . length ( strlist )
Calculate the current length of this symlink record .
20,164
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'SL record not yet initialized!' ) outlist = [ b'SL' , struct . pack ( '=BBB' , self . current_length ( ) , SU_ENTRY_VERSION , self . flags ) ] for comp in self . symlink_components : outlist . append ( comp . record ( ) ...
Generate a string representing the Rock Ridge Symbolic Link record .
20,165
def name ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'SL record not yet initialized!' ) outlist = [ ] continued = False for comp in self . symlink_components : name = comp . name ( ) if name == b'/' : outlist = [ ] continued = False name = b'' if not continued : outlist . app...
Generate a string that contains all components of the symlink .
20,166
def set_last_component_continued ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'SL record not yet initialized!' ) if not self . symlink_components : raise pycdlibexception . PyCdlibInternalError ( 'Trying to set continued on a non-existent component!' ) self . symlink_component...
Set the previous component of this SL record to continued .
20,167
def last_component_continued ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'SL record not yet initialized!' ) if not self . symlink_components : raise pycdlibexception . PyCdlibInternalError ( 'Trying to get continued on a non-existent component!' ) return self . symlink_compon...
Determines whether the previous component of this SL record is a continued one or not .
20,168
def length ( symlink_components ) : length = RRSLRecord . header_length ( ) for comp in symlink_components : length += RRSLRecord . Component . length ( comp ) return length
Static method to return the length of the Rock Ridge Symbolic Link record .
20,169
def parse ( self , rrstr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'NM record already initialized!' ) ( su_len , su_entry_version_unused , self . posix_name_flags ) = struct . unpack_from ( '=BBB' , rrstr [ : 5 ] , 2 ) name_len = su_len - 5 if ( self . posix_name_flags & 0x7 ) not in ...
Parse a Rock Ridge Alternate Name record out of a string .
20,170
def new ( self , rr_name ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'NM record already initialized!' ) self . posix_name = rr_name self . posix_name_flags = 0 self . _initialized = True
Create a new Rock Ridge Alternate Name record .
20,171
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'NM record not yet initialized!' ) return b'NM' + struct . pack ( b'=BBB' , RRNMRecord . length ( self . posix_name ) , SU_ENTRY_VERSION , self . posix_name_flags ) + self . posix_name
Generate a string representing the Rock Ridge Alternate Name record .
20,172
def parse ( self , rrstr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'CL record already initialized!' ) ( su_len , su_entry_version_unused , child_log_block_num_le , child_log_block_num_be ) = struct . unpack_from ( '=BBLL' , rrstr [ : 12 ] , 2 ) if su_len != RRCLRecord . length ( ) : r...
Parse a Rock Ridge Child Link record out of a string .
20,173
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'CL record already initialized!' ) self . child_log_block_num = 0 self . _initialized = True
Create a new Rock Ridge Child Link record .
20,174
def set_log_block_num ( self , bl ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'CL record not yet initialized!' ) self . child_log_block_num = bl
Set the logical block number for the child .
20,175
def parse ( self , rrstr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'PL record already initialized!' ) ( su_len , su_entry_version_unused , parent_log_block_num_le , parent_log_block_num_be ) = struct . unpack_from ( '=BBLL' , rrstr [ : 12 ] , 2 ) if su_len != RRPLRecord . length ( ) :...
Parse a Rock Ridge Parent Link record out of a string .
20,176
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'PL record already initialized!' ) self . parent_log_block_num = 0 self . _initialized = True
Generate a string representing the Rock Ridge Parent Link record .
20,177
def set_log_block_num ( self , bl ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'PL record not yet initialized!' ) self . parent_log_block_num = bl
Set the logical block number for the parent .
20,178
def parse ( self , rrstr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'TF record already initialized!' ) ( su_len , su_entry_version_unused , self . time_flags , ) = struct . unpack_from ( '=BBB' , rrstr [ : 5 ] , 2 ) if su_len < 5 : raise pycdlibexception . PyCdlibInvalidISO ( 'Not enou...
Parse a Rock Ridge Time Stamp record out of a string .
20,179
def new ( self , time_flags ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'TF record already initialized!' ) self . time_flags = time_flags tflen = 7 if self . time_flags & ( 1 << 7 ) : tflen = 17 for index , fieldname in enumerate ( self . FIELDNAMES ) : if self . time_flags & ( 1 << ind...
Create a new Rock Ridge Time Stamp record .
20,180
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'TF record not yet initialized!' ) outlist = [ b'TF' , struct . pack ( '=BBB' , RRTFRecord . length ( self . time_flags ) , SU_ENTRY_VERSION , self . time_flags ) ] for fieldname in self . FIELDNAMES : field = getattr ( s...
Generate a string representing the Rock Ridge Time Stamp record .
20,181
def length ( time_flags ) : tf_each_size = 7 if time_flags & ( 1 << 7 ) : tf_each_size = 17 time_flags &= 0x7f tf_num = 0 while time_flags : time_flags &= time_flags - 1 tf_num += 1 return 5 + tf_each_size * tf_num
Static method to return the length of the Rock Ridge Time Stamp record .
20,182
def parse ( self , rrstr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'SF record already initialized!' ) ( su_len , su_entry_version_unused , ) = struct . unpack_from ( '=BB' , rrstr [ : 4 ] , 2 ) if su_len == 12 : ( virtual_file_size_le , virtual_file_size_be ) = struct . unpack_from ( ...
Parse a Rock Ridge Sparse File record out of a string .
20,183
def new ( self , file_size_high , file_size_low , table_depth ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'SF record already initialized!' ) self . virtual_file_size_high = file_size_high self . virtual_file_size_low = file_size_low self . table_depth = table_depth self . _initialized =...
Create a new Rock Ridge Sparse File record .
20,184
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'SF record not yet initialized!' ) length = 12 if self . virtual_file_size_high is not None : length = 21 ret = b'SF' + struct . pack ( '=BB' , length , SU_ENTRY_VERSION ) if self . virtual_file_size_high is not None and ...
Generate a string representing the Rock Ridge Sparse File record .
20,185
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'RE record not yet initialized!' ) return b'RE' + struct . pack ( '=BB' , RRRERecord . length ( ) , SU_ENTRY_VERSION )
Generate a string representing the Rock Ridge Relocated Directory record .
20,186
def parse ( self , rrstr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'ST record already initialized!' ) ( su_len , su_entry_version_unused ) = struct . unpack_from ( '=BB' , rrstr [ : 4 ] , 2 ) if su_len != 4 : raise pycdlibexception . PyCdlibInvalidISO ( 'Invalid length on rock ridge e...
Parse a Rock Ridge System Terminator record out of a string .
20,187
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'ST record not yet initialized!' ) return b'ST' + struct . pack ( '=BB' , RRSTRecord . length ( ) , SU_ENTRY_VERSION )
Generate a string representing the Rock Ridge System Terminator record .
20,188
def parse ( self , rrstr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'PD record already initialized!' ) ( su_len_unused , su_entry_version_unused ) = struct . unpack_from ( '=BB' , rrstr [ : 4 ] , 2 ) self . padding = rrstr [ 4 : ] self . _initialized = True
Parse a Rock Ridge Platform Dependent record out of a string .
20,189
def new ( self ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'PD record already initialized!' ) self . _initialized = True self . padding = b''
Create a new Rock Ridge Platform Dependent record .
20,190
def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'PD record not yet initialized!' ) return b'PD' + struct . pack ( '=BB' , RRPDRecord . length ( self . padding ) , SU_ENTRY_VERSION ) + self . padding
Generate a string representing the Rock Ridge Platform Dependent record .
20,191
def has_entry ( self , name ) : return getattr ( self . dr_entries , name ) or getattr ( self . ce_entries , name )
An internal method to tell if we have already parsed an entry of the named type .
20,192
def _record ( self , entries ) : outlist = [ ] if entries . sp_record is not None : outlist . append ( entries . sp_record . record ( ) ) if entries . rr_record is not None : outlist . append ( entries . rr_record . record ( ) ) for nm_record in entries . nm_records : outlist . append ( nm_record . record ( ) ) if entr...
Return a string representing the Rock Ridge entry .
20,193
def record_dr_entries ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Rock Ridge extension not yet initialized' ) return self . _record ( self . dr_entries )
Return a string representing the Rock Ridge entries in the Directory Record .
20,194
def record_ce_entries ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Rock Ridge extension not yet initialized' ) return self . _record ( self . ce_entries )
Return a string representing the Rock Ridge entries in the Continuation Entry .
20,195
def _add_ce_record ( self , curr_dr_len , thislen ) : if self . dr_entries . ce_record is None : self . dr_entries . ce_record = RRCERecord ( ) self . dr_entries . ce_record . new ( ) curr_dr_len += RRCERecord . length ( ) self . dr_entries . ce_record . add_record ( thislen ) return curr_dr_len
An internal method to add a new length to a Continuation Entry . If the Continuation Entry does not yet exist this method creates it .
20,196
def _add_name ( self , rr_name , curr_dr_len ) : len_here = ALLOWED_DR_SIZE - curr_dr_len - 5 if len_here < len ( rr_name ) : curr_dr_len = self . _add_ce_record ( curr_dr_len , 0 ) len_here = ALLOWED_DR_SIZE - curr_dr_len - 5 curr_nm = RRNMRecord ( ) curr_nm . new ( rr_name [ : len_here ] ) self . dr_entries . nm_reco...
An internal method to add the appropriate name records to the ISO .
20,197
def add_to_file_links ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Rock Ridge extension not yet initialized' ) if self . dr_entries . px_record is None : if self . ce_entries . px_record is None : raise pycdlibexception . PyCdlibInvalidInput ( 'No Rock Ridge file links' ) sel...
Increment the number of POSIX file links on this entry by one .
20,198
def copy_file_links ( self , src ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Rock Ridge extension not yet initialized' ) if src . dr_entries . px_record is None : if src . ce_entries . px_record is None : raise pycdlibexception . PyCdlibInvalidInput ( 'No Rock Ridge file links' ) n...
Copy the number of file links from the source Rock Ridge entry into this Rock Ridge entry .
20,199
def get_file_mode ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Rock Ridge extension not yet initialized' ) if self . dr_entries . px_record is None : if self . ce_entries . px_record is None : raise pycdlibexception . PyCdlibInvalidInput ( 'No Rock Ridge file mode' ) return s...
Get the POSIX file mode bits for this Rock Ridge entry .