idx int64 0 63k | question stringlengths 53 5.28k | target stringlengths 5 805 |
|---|---|---|
20,300 | def copy_sizes ( self , othervd ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This Volume Descriptor is not yet initialized' ) self . space_size = othervd . space_size self . path_tbl_size = othervd . path_tbl_size self . path_table_num_extents = othervd . path_table_num_extents | Copy the path_tbl_size path_table_num_extents and space_size from another volume descriptor . |
20,301 | def parse ( self , ident_str ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This File or Text identifier is already initialized' ) self . text = ident_str self . _initialized = True | Parse a file or text identifier out of a string . |
20,302 | def new ( self , text ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This File or Text identifier is already initialized' ) if len ( text ) != 128 : raise pycdlibexception . PyCdlibInvalidInput ( 'Length of text must be 128' ) self . text = text self . _initialized = True | Create a new file or text identifier . |
20,303 | def parse ( self , vd , extent_loc ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Volume Descriptor Set Terminator already initialized' ) ( descriptor_type , identifier , version , zero_unused ) = struct . unpack_from ( self . FMT , vd , 0 ) if descriptor_type != VOLUME_DESCRIPTOR_TYPE_SE... | A method to parse a Volume Descriptor Set Terminator out of a string . |
20,304 | def parse ( self , vd , extent_loc ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Boot Record already initialized' ) ( descriptor_type , identifier , version , self . boot_system_identifier , self . boot_identifier , self . boot_system_use ) = struct . unpack_from ( self . FMT , vd , 0 ) ... | A method to parse a Boot Record out of a string . |
20,305 | def new ( self , boot_system_id ) : if self . _initialized : raise Exception ( 'Boot Record already initialized' ) self . boot_system_identifier = boot_system_id . ljust ( 32 , b'\x00' ) self . boot_identifier = b'\x00' * 32 self . boot_system_use = b'\x00' * 197 self . _initialized = True | A method to create a new Boot Record . |
20,306 | def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Boot Record not yet initialized' ) return struct . pack ( self . FMT , VOLUME_DESCRIPTOR_TYPE_BOOT_RECORD , b'CD001' , 1 , self . boot_system_identifier , self . boot_identifier , self . boot_system_use ) | A method to generate a string representing this Boot Record . |
20,307 | def update_boot_system_use ( self , boot_sys_use ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'Boot Record not yet initialized' ) self . boot_system_use = boot_sys_use . ljust ( 197 , b'\x00' ) | A method to update the boot system use field of this Boot Record . |
20,308 | def parse ( self , data , extent ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This Version Volume Descriptor is already initialized' ) if data [ : 3 ] == b'MKI' or data == allzero : self . _data = data self . orig_extent_loc = extent self . _initialized = True return True return False | Do a parse of a Version Volume Descriptor . This consists of seeing whether the data is either all zero or starts with MKI and if so setting the extent location of the Version Volume Descriptor properly . |
20,309 | def new ( self , log_block_size ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This Version Volume Descriptor is already initialized' ) self . _data = b'\x00' * log_block_size self . _initialized = True | Create a new Version Volume Descriptor . |
20,310 | def parse ( self , vd , datastr , ino ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This Eltorito Boot Info Table is already initialized' ) ( pvd_extent , rec_extent , self . orig_len , self . csum ) = struct . unpack_from ( '=LLLL' , datastr , 0 ) if pvd_extent != vd . extent_location (... | A method to parse a boot info table out of a string . |
20,311 | def new ( self , vd , ino , orig_len , csum ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This Eltorito Boot Info Table is already initialized' ) self . vd = vd self . orig_len = orig_len self . csum = csum self . inode = ino self . _initialized = True | A method to create a new boot info table . |
20,312 | def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'This Eltorito Boot Info Table not yet initialized' ) return struct . pack ( '=LLLL' , self . vd . extent_location ( ) , self . inode . extent_location ( ) , self . orig_len , self . csum ) + b'\x00' * 40 | A method to generate a string representing this boot info table . |
20,313 | def parse ( self , valstr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'El Torito Validation Entry already initialized' ) ( header_id , self . platform_id , reserved_unused , self . id_string , self . checksum , keybyte1 , keybyte2 ) = struct . unpack_from ( self . FMT , valstr , 0 ) if ... | A method to parse an El Torito Validation Entry out of a string . |
20,314 | def new ( self , platform_id ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'El Torito Validation Entry already initialized' ) self . platform_id = platform_id self . id_string = b'\x00' * 24 self . checksum = 0 self . checksum = utils . swab_16bit ( self . _checksum ( self . _record ( ) )... | A method to create a new El Torito Validation Entry . |
20,315 | def _record ( self ) : return struct . pack ( self . FMT , 1 , self . platform_id , 0 , self . id_string , self . checksum , 0x55 , 0xaa ) | An internal method to generate a string representing this El Torito Validation Entry . |
20,316 | def parse ( self , valstr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'El Torito Entry already initialized' ) ( self . boot_indicator , self . boot_media_type , self . load_segment , self . system_type , unused1 , self . sector_count , self . load_rba , self . selection_criteria_type , ... | A method to parse an El Torito Entry out of a string . |
20,317 | def new ( self , sector_count , load_seg , media_name , system_type , bootable ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'El Torito Entry already initialized' ) if media_name == 'noemul' : media_type = self . MEDIA_NO_EMUL elif media_name == 'floppy' : if sector_count == 2400 : media_... | A method to create a new El Torito Entry . |
20,318 | def set_inode ( self , ino ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'El Torito Entry not yet initialized' ) self . inode = ino | A method to set the Inode associated with this El Torito Entry . |
20,319 | def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'El Torito Entry not yet initialized' ) return struct . pack ( self . FMT , self . boot_indicator , self . boot_media_type , self . load_segment , self . system_type , 0 , self . sector_count , self . load_rba , self . se... | A method to generate a string representing this El Torito Entry . |
20,320 | def set_data_length ( self , length ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'El Torito Entry not initialized' ) self . sector_count = utils . ceiling_div ( length , 512 ) | A method to set the length of data for this El Torito Entry . |
20,321 | def parse ( self , valstr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'El Torito Section Header already initialized' ) ( self . header_indicator , self . platform_id , self . num_section_entries , self . id_string ) = struct . unpack_from ( self . FMT , valstr , 0 ) self . _initialized ... | Parse an El Torito section header from a string . |
20,322 | def new ( self , id_string , platform_id ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'El Torito Section Header already initialized' ) self . header_indicator = 0x91 self . platform_id = platform_id self . num_section_entries = 0 self . id_string = id_string self . _initialized = True | Create a new El Torito section header . |
20,323 | def add_parsed_entry ( self , entry ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'El Torito Section Header not yet initialized' ) if len ( self . section_entries ) >= self . num_section_entries : raise pycdlibexception . PyCdlibInvalidInput ( 'Eltorito section had more entries than e... | A method to add a parsed entry to the list of entries of this header . If the number of parsed entries exceeds what was expected from the initial parsing of the header this method will throw an Exception . |
20,324 | def add_new_entry ( self , entry ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'El Torito Section Header not yet initialized' ) self . num_section_entries += 1 self . section_entries . append ( entry ) | A method to add a completely new entry to the list of entries of this header . |
20,325 | def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'El Torito Section Header not yet initialized' ) outlist = [ struct . pack ( self . FMT , self . header_indicator , self . platform_id , self . num_section_entries , self . id_string ) ] for entry in self . section_entrie... | Get a string representing this El Torito section header . |
20,326 | def parse ( self , valstr ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'El Torito Boot Catalog already initialized' ) if self . state == self . EXPECTING_VALIDATION_ENTRY : self . validation_entry . parse ( valstr ) self . state = self . EXPECTING_INITIAL_ENTRY elif self . state == self ... | A method to parse an El Torito Boot Catalog out of a string . |
20,327 | def new ( self , br , ino , sector_count , load_seg , media_name , system_type , platform_id , bootable ) : if self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'El Torito Boot Catalog already initialized' ) self . validation_entry . new ( platform_id ) self . initial_entry . new ( sector_count , lo... | A method to create a new El Torito Boot Catalog . |
20,328 | def add_section ( self , ino , sector_count , load_seg , media_name , system_type , efi , bootable ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'El Torito Boot Catalog not yet initialized' ) if len ( self . sections ) == 31 : raise pycdlibexception . PyCdlibInvalidInput ( 'Too many E... | A method to add an section header and entry to this Boot Catalog . |
20,329 | def record ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'El Torito Boot Catalog not yet initialized' ) outlist = [ self . validation_entry . record ( ) , self . initial_entry . record ( ) ] for sec in self . sections : outlist . append ( sec . record ( ) ) for entry in self . ... | A method to generate a string representing this El Torito Boot Catalog . |
20,330 | def add_dirrecord ( self , rec ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'El Torito Boot Catalog not yet initialized' ) self . dirrecords . append ( rec ) | A method to set the Directory Record associated with this Boot Catalog . |
20,331 | def update_catalog_extent ( self , current_extent ) : if not self . _initialized : raise pycdlibexception . PyCdlibInternalError ( 'El Torito Boot Catalog not yet initialized' ) self . br . update_boot_system_use ( struct . pack ( '=L' , current_extent ) ) | A method to update the extent associated with this Boot Catalog . |
20,332 | def _check_d1_characters ( name ) : bytename = bytearray ( name ) for char in bytename : if char not in _allowed_d1_characters : raise pycdlibexception . PyCdlibInvalidInput ( 'ISO9660 filenames must consist of characters A-Z, 0-9, and _' ) | A function to check that a name only uses d1 characters as defined by ISO9660 . |
20,333 | def _split_iso9660_filename ( fullname ) : namesplit = fullname . split ( b';' ) version = b'' if len ( namesplit ) > 1 : version = namesplit . pop ( ) rest = b';' . join ( namesplit ) dotsplit = rest . split ( b'.' ) if len ( dotsplit ) == 1 : name = dotsplit [ 0 ] extension = b'' else : name = b'.' . join ( dotsplit ... | A function to split an ISO 9660 filename into its constituent parts . This is the name the extension and the version number . |
20,334 | def _check_iso9660_filename ( fullname , interchange_level ) : ( name , extension , version ) = _split_iso9660_filename ( fullname ) if version != b'' and ( int ( version ) < 1 or int ( version ) > 32767 ) : raise pycdlibexception . PyCdlibInvalidInput ( 'ISO9660 filenames must have a version between 1 and 32767' ) if ... | A function to check that a file identifier conforms to the ISO9660 rules for a particular interchange level . |
20,335 | def _check_iso9660_directory ( fullname , interchange_level ) : if not fullname : raise pycdlibexception . PyCdlibInvalidInput ( 'ISO9660 directory names must be at least 1 character long' ) maxlen = float ( 'inf' ) if interchange_level == 1 : maxlen = 8 elif interchange_level in ( 2 , 3 ) : maxlen = 207 if len ( fulln... | A function to check that an directory identifier conforms to the ISO9660 rules for a particular interchange level . |
20,336 | def _interchange_level_from_filename ( fullname ) : ( name , extension , version ) = _split_iso9660_filename ( fullname ) interchange_level = 1 if version != b'' and ( int ( version ) < 1 or int ( version ) > 32767 ) : interchange_level = 3 if b';' in name or b';' in extension : interchange_level = 3 if len ( name ) > ... | A function to determine the ISO interchange level from the filename . In theory there are 3 levels but in practice we only deal with level 1 and level 3 . |
20,337 | def _interchange_level_from_directory ( name ) : interchange_level = 1 if len ( name ) > 8 : interchange_level = 3 try : _check_d1_characters ( name ) except pycdlibexception . PyCdlibInvalidInput : interchange_level = 3 return interchange_level | A function to determine the ISO interchange level from the directory name . In theory there are 3 levels but in practice we only deal with level 1 and level 3 . |
20,338 | def _yield_children ( rec ) : if not rec . is_dir ( ) : raise pycdlibexception . PyCdlibInvalidInput ( 'Record is not a directory!' ) last = b'' for child in rec . children : fi = child . file_identifier ( ) if fi == last : continue last = fi if child . rock_ridge is not None and child . rock_ridge . child_link_record_... | An internal function to gather and yield all of the children of a Directory Record . |
20,339 | def _assign_udf_desc_extents ( descs , start_extent ) : current_extent = start_extent descs . pvd . set_extent_location ( current_extent ) current_extent += 1 descs . impl_use . set_extent_location ( current_extent ) current_extent += 1 descs . partition . set_extent_location ( current_extent ) current_extent += 1 desc... | An internal function to assign a consecutive sequence of extents for the given set of UDF Descriptors starting at the given extent . |
20,340 | def _find_dr_record_by_name ( vd , path , encoding ) : if not utils . starts_with_slash ( path ) : raise pycdlibexception . PyCdlibInvalidInput ( 'Must be a path starting with /' ) root_dir_record = vd . root_directory_record ( ) if path == b'/' : return root_dir_record splitpath = utils . split_path ( path ) currpath ... | An internal function to find an directory record on the ISO given an ISO or Joliet path . If the entry is found it returns the directory record object corresponding to that entry . If the entry could not be found a pycdlibexception . PyCdlibInvalidInput exception is raised . |
20,341 | def read ( self , size = None ) : if not self . _open : raise pycdlibexception . PyCdlibInvalidInput ( 'I/O operation on closed file.' ) if self . _offset >= self . _length : return b'' if size is None or size < 0 : data = self . readall ( ) else : readsize = min ( self . _length - self . _offset , size ) data = self .... | A method to read and return up to size bytes . |
20,342 | def readall ( self ) : if not self . _open : raise pycdlibexception . PyCdlibInvalidInput ( 'I/O operation on closed file.' ) readsize = self . _length - self . _offset if readsize > 0 : data = self . _fp . read ( readsize ) self . _offset += readsize else : data = b'' return data | A method to read and return the remaining bytes in the file . |
20,343 | def _parse_volume_descriptors ( self ) : self . _cdfp . seek ( 16 * 2048 ) while True : curr_extent = self . _cdfp . tell ( ) // 2048 vd = self . _cdfp . read ( 2048 ) if len ( vd ) != 2048 : raise pycdlibexception . PyCdlibInvalidISO ( 'Failed to read entire volume descriptor' ) ( desc_type , ident ) = struct . unpack... | An internal method to parse the volume descriptors on an ISO . |
20,344 | def _seek_to_extent ( self , extent ) : self . _cdfp . seek ( extent * self . pvd . logical_block_size ( ) ) | An internal method to seek to a particular extent on the input ISO . |
20,345 | def _find_rr_record ( self , rr_path ) : if not utils . starts_with_slash ( rr_path ) : raise pycdlibexception . PyCdlibInvalidInput ( 'Must be a path starting with /' ) root_dir_record = self . pvd . root_directory_record ( ) if rr_path == b'/' : return root_dir_record splitpath = utils . split_path ( rr_path ) currpa... | An internal method to find an directory record on the ISO given a Rock Ridge path . If the entry is found it returns the directory record object corresponding to that entry . If the entry could not be found a pycdlibexception . PyCdlibInvalidInput is raised . |
20,346 | def _find_joliet_record ( self , joliet_path ) : if self . joliet_vd is None : raise pycdlibexception . PyCdlibInternalError ( 'Joliet path requested on non-Joliet ISO' ) return _find_dr_record_by_name ( self . joliet_vd , joliet_path , 'utf-16_be' ) | An internal method to find an directory record on the ISO given a Joliet path . If the entry is found it returns the directory record object corresponding to that entry . If the entry could not be found a pycdlibexception . PyCdlibInvalidInput is raised . |
20,347 | def _find_udf_record ( self , udf_path ) : if udf_path == b'/' : return None , self . udf_root splitpath = utils . split_path ( udf_path ) currpath = splitpath . pop ( 0 ) entry = self . udf_root while entry is not None : child = entry . find_file_ident_desc_by_name ( currpath ) if not splitpath : return child , child ... | An internal method to find an directory record on the ISO given a UDF path . If the entry is found it returns the directory record object corresponding to that entry . If the entry could not be found a pycdlibexception . PyCdlibInvalidInput is raised . |
20,348 | def _iso_name_and_parent_from_path ( self , iso_path ) : splitpath = utils . split_path ( iso_path ) name = splitpath . pop ( ) parent = self . _find_iso_record ( b'/' + b'/' . join ( splitpath ) ) return ( name . decode ( 'utf-8' ) . encode ( 'utf-8' ) , parent ) | An internal method to find the parent directory record and name given an ISO path . If the parent is found return a tuple containing the basename of the path and the parent directory record object . |
20,349 | def _joliet_name_and_parent_from_path ( self , joliet_path ) : splitpath = utils . split_path ( joliet_path ) name = splitpath . pop ( ) if len ( name ) > 64 : raise pycdlibexception . PyCdlibInvalidInput ( 'Joliet names can be a maximum of 64 characters' ) parent = self . _find_joliet_record ( b'/' + b'/' . join ( spl... | An internal method to find the parent directory record and name given a Joliet path . If the parent is found return a tuple containing the basename of the path and the parent directory record object . |
20,350 | def _udf_name_and_parent_from_path ( self , udf_path ) : splitpath = utils . split_path ( udf_path ) name = splitpath . pop ( ) ( parent_ident_unused , parent ) = self . _find_udf_record ( b'/' + b'/' . join ( splitpath ) ) return ( name . decode ( 'utf-8' ) . encode ( 'utf-8' ) , parent ) | An internal method to find the parent directory record and name given a UDF path . If the parent is found return a tuple containing the basename of the path and the parent UDF File Entry object . |
20,351 | def _set_rock_ridge ( self , rr ) : if not self . rock_ridge : self . rock_ridge = rr else : for ver in [ '1.09' , '1.10' , '1.12' ] : if self . rock_ridge == ver : if rr and rr != ver : raise pycdlibexception . PyCdlibInvalidISO ( 'Inconsistent Rock Ridge versions on the ISO!' ) | An internal method to set the Rock Ridge version of the ISO given the Rock Ridge version of the previous entry . |
20,352 | def _parse_path_table ( self , ptr_size , extent ) : self . _seek_to_extent ( extent ) data = self . _cdfp . read ( ptr_size ) offset = 0 out = [ ] extent_to_ptr = { } while offset < ptr_size : ptr = path_table_record . PathTableRecord ( ) len_di_byte = bytearray ( [ data [ offset ] ] ) [ 0 ] read_len = path_table_reco... | An internal method to parse a path table on an ISO . For each path table entry found a Path Table Record object is created and the callback is called . |
20,353 | def _check_and_parse_eltorito ( self , br ) : if br . boot_system_identifier != b'EL TORITO SPECIFICATION' . ljust ( 32 , b'\x00' ) : return if self . eltorito_boot_catalog is not None : raise pycdlibexception . PyCdlibInvalidISO ( 'Only one El Torito boot record is allowed' ) if br . extent_location ( ) != 17 : raise ... | An internal method to examine a Boot Record and see if it is an El Torito Boot Record . If it is parse the El Torito Boot Catalog verification entry initial entry and any additional section entries . |
20,354 | def _remove_child_from_dr ( self , child , index , logical_block_size ) : if child . parent is None : raise pycdlibexception . PyCdlibInternalError ( 'Trying to remove child from non-existent parent' ) self . _find_iso_record . cache_clear ( ) self . _find_rr_record . cache_clear ( ) self . _find_joliet_record . cache_... | An internal method to remove a child from a directory record shrinking the space in the Volume Descriptor if necessary . |
20,355 | def _add_to_ptr_size ( self , ptr ) : num_bytes_to_add = 0 for pvd in self . pvds : if pvd . add_to_ptr_size ( path_table_record . PathTableRecord . record_length ( ptr . len_di ) ) : num_bytes_to_add += 4 * self . pvd . logical_block_size ( ) return num_bytes_to_add | An internal method to add a PTR to a VD adding space to the VD if necessary . |
20,356 | def _remove_from_ptr_size ( self , ptr ) : num_bytes_to_remove = 0 for pvd in self . pvds : if pvd . remove_from_ptr_size ( path_table_record . PathTableRecord . record_length ( ptr . len_di ) ) : num_bytes_to_remove += 4 * self . pvd . logical_block_size ( ) return num_bytes_to_remove | An internal method to remove a PTR from a VD removing space from the VD if necessary . |
20,357 | def _calculate_eltorito_boot_info_table_csum ( self , data_fp , data_len ) : num_sectors = utils . ceiling_div ( data_len , self . pvd . logical_block_size ( ) ) csum = 0 curr_sector = 0 while curr_sector < num_sectors : block = data_fp . read ( self . pvd . logical_block_size ( ) ) block = block . ljust ( 2048 , b'\x0... | An internal method to calculate the checksum for an El Torito Boot Info Table . This checksum is a simple 32 - bit checksum over all of the data in the boot file starting right after the Boot Info Table itself . |
20,358 | def _check_for_eltorito_boot_info_table ( self , ino ) : orig = self . _cdfp . tell ( ) with inode . InodeOpenData ( ino , self . pvd . logical_block_size ( ) ) as ( data_fp , data_len ) : data_fp . seek ( 8 , os . SEEK_CUR ) bi_table = eltorito . EltoritoBootInfoTable ( ) if bi_table . parse ( self . pvd , data_fp . r... | An internal method to check a boot directory record to see if it has an El Torito Boot Info Table embedded inside of it . |
20,359 | def _check_rr_name ( self , rr_name ) : if self . rock_ridge : if not rr_name : raise pycdlibexception . PyCdlibInvalidInput ( 'A rock ridge name must be passed for a rock-ridge ISO' ) if rr_name . count ( '/' ) != 0 : raise pycdlibexception . PyCdlibInvalidInput ( 'A rock ridge name must be relative' ) return rr_name ... | An internal method to check whether this ISO requires or does not require a Rock Ridge path . |
20,360 | def _normalize_joliet_path ( self , joliet_path ) : tmp_path = b'' if self . joliet_vd is not None : if not joliet_path : raise pycdlibexception . PyCdlibInvalidInput ( 'A Joliet path must be passed for a Joliet ISO' ) tmp_path = utils . normpath ( joliet_path ) else : if joliet_path : raise pycdlibexception . PyCdlibI... | An internal method to check whether this ISO does or does not require a Joliet path . If a Joliet path is required the path is normalized and returned . |
20,361 | def _link_eltorito ( self , extent_to_inode ) : if self . eltorito_boot_catalog is None : raise pycdlibexception . PyCdlibInternalError ( 'Trying to link El Torito entries on a non-El Torito ISO' ) log_block_size = self . pvd . logical_block_size ( ) entries_to_assign = [ self . eltorito_boot_catalog . initial_entry ] ... | An internal method to link the El Torito entries into their corresponding Directory Records creating new ones if they are hidden . Should only be called on an El Torito ISO . |
20,362 | def _parse_udf_vol_descs ( self , extent , length , descs ) : self . _seek_to_extent ( extent ) vd_data = self . _cdfp . read ( length ) block_size = self . pvd . logical_block_size ( ) offset = 0 current_extent = extent done = False while not done : desc_tag = udfmod . UDFTag ( ) desc_tag . parse ( vd_data [ offset : ... | An internal method to parse a set of UDF Volume Descriptors . |
20,363 | def _parse_udf_descriptors ( self ) : block_size = self . pvd . logical_block_size ( ) anchor_locations = [ ( 256 * block_size , os . SEEK_SET ) , ( - 2048 , os . SEEK_END ) ] for loc , whence in anchor_locations : self . _cdfp . seek ( loc , whence ) extent = self . _cdfp . tell ( ) // 2048 anchor_data = self . _cdfp ... | An internal method to parse the UDF descriptors on the ISO . This should only be called if it the ISO has a valid UDF Volume Recognition Sequence at the beginning of the ISO . |
20,364 | def _parse_udf_file_entry ( self , abs_file_entry_extent , icb , parent ) : self . _seek_to_extent ( abs_file_entry_extent ) icbdata = self . _cdfp . read ( icb . extent_length ) if all ( v == 0 for v in bytearray ( icbdata ) ) : return None desc_tag = udfmod . UDFTag ( ) desc_tag . parse ( icbdata , icb . log_block_nu... | An internal method to parse a single UDF File Entry and return the corresponding object . |
20,365 | def _walk_udf_directories ( self , extent_to_inode ) : part_start = self . udf_main_descs . partition . part_start_location self . udf_root = self . _parse_udf_file_entry ( part_start + self . udf_file_set . root_dir_icb . log_block_num , self . udf_file_set . root_dir_icb , None ) log_block_size = self . pvd . logical... | An internal method to walk a UDF filesystem and add all the metadata to this object . |
20,366 | def _udf_get_file_from_iso_fp ( self , outfp , blocksize , udf_path ) : if self . udf_root is None : raise pycdlibexception . PyCdlibInvalidInput ( 'Cannot fetch a udf_path from a non-UDF ISO' ) ( ident_unused , found_file_entry ) = self . _find_udf_record ( udf_path ) if found_file_entry is None : raise pycdlibexcepti... | An internal method to fetch a single UDF file from the ISO and write it out to the file object . |
20,367 | def _outfp_write_with_check ( self , outfp , data , enable_overwrite_check = True ) : start = outfp . tell ( ) outfp . write ( data ) if self . _track_writes : end = outfp . tell ( ) if end > self . pvd . space_size * self . pvd . logical_block_size ( ) : raise pycdlibexception . PyCdlibInternalError ( 'Wrote past the ... | Internal method to write data out to the output file descriptor ensuring that it doesn t go beyond the bounds of the ISO . |
20,368 | def _output_file_data ( self , outfp , blocksize , ino ) : log_block_size = self . pvd . logical_block_size ( ) outfp . seek ( ino . extent_location ( ) * log_block_size ) tmp_start = outfp . tell ( ) with inode . InodeOpenData ( ino , log_block_size ) as ( data_fp , data_len ) : utils . copy_data ( data_len , blocksiz... | Internal method to write a directory record entry out . |
20,369 | def _write_directory_records ( self , vd , outfp , progress ) : log_block_size = vd . logical_block_size ( ) le_ptr_offset = 0 be_ptr_offset = 0 dirs = collections . deque ( [ vd . root_directory_record ( ) ] ) while dirs : curr = dirs . popleft ( ) curr_dirrecord_offset = 0 if curr . is_dir ( ) : if curr . ptr is None... | An internal method to write out the directory records from a particular Volume Descriptor . |
20,370 | def _write_udf_descs ( self , descs , outfp , progress ) : log_block_size = self . pvd . logical_block_size ( ) outfp . seek ( descs . pvd . extent_location ( ) * log_block_size ) rec = descs . pvd . record ( ) self . _outfp_write_with_check ( outfp , rec ) progress . call ( len ( rec ) ) outfp . seek ( descs . impl_us... | An internal method to write out a UDF Descriptor sequence . |
20,371 | def _update_rr_ce_entry ( self , rec ) : if rec . rock_ridge is not None and rec . rock_ridge . dr_entries . ce_record is not None : celen = rec . rock_ridge . dr_entries . ce_record . len_cont_area added_block , block , offset = self . pvd . add_rr_ce_entry ( celen ) rec . rock_ridge . update_ce_block ( block ) rec . ... | An internal method to update the Rock Ridge CE entry for the given record . |
20,372 | def _finish_add ( self , num_bytes_to_add , num_partition_bytes_to_add ) : for pvd in self . pvds : pvd . add_to_space_size ( num_bytes_to_add + num_partition_bytes_to_add ) if self . joliet_vd is not None : self . joliet_vd . add_to_space_size ( num_bytes_to_add + num_partition_bytes_to_add ) if self . enhanced_vd is ... | An internal method to do all of the accounting needed whenever something is added to the ISO . This method should only be called by public API implementations . |
20,373 | def _finish_remove ( self , num_bytes_to_remove , is_partition ) : for pvd in self . pvds : pvd . remove_from_space_size ( num_bytes_to_remove ) if self . joliet_vd is not None : self . joliet_vd . remove_from_space_size ( num_bytes_to_remove ) if self . enhanced_vd is not None : self . enhanced_vd . copy_sizes ( self ... | An internal method to do all of the accounting needed whenever something is removed from the ISO . This method should only be called by public API implementations . |
20,374 | def _rm_dr_link ( self , rec ) : if not rec . is_file ( ) : raise pycdlibexception . PyCdlibInvalidInput ( 'Cannot remove a directory with rm_hard_link (try rm_directory instead)' ) num_bytes_to_remove = 0 logical_block_size = rec . vd . logical_block_size ( ) done = False while not done : num_bytes_to_remove += self .... | An internal method to remove a Directory Record link given the record . |
20,375 | def _rm_udf_file_ident ( self , parent , fi ) : logical_block_size = self . pvd . logical_block_size ( ) num_extents_to_remove = parent . remove_file_ident_desc_by_name ( fi , logical_block_size ) self . udf_logical_volume_integrity . logical_volume_impl_use . num_files -= 1 self . _find_udf_record . cache_clear ( ) re... | An internal method to remove a UDF File Identifier from the parent and remove any space from the Logical Volume as necessary . |
20,376 | def _rm_udf_link ( self , rec ) : if not rec . is_file ( ) and not rec . is_symlink ( ) : raise pycdlibexception . PyCdlibInvalidInput ( 'Cannot remove a directory with rm_hard_link (try rm_directory instead)' ) logical_block_size = self . pvd . logical_block_size ( ) num_bytes_to_remove = 0 if rec . inode is not None ... | An internal method to remove a UDF File Entry link . |
20,377 | def _add_joliet_dir ( self , joliet_path ) : if self . joliet_vd is None : raise pycdlibexception . PyCdlibInternalError ( 'Tried to add joliet dir to non-Joliet ISO' ) ( joliet_name , joliet_parent ) = self . _joliet_name_and_parent_from_path ( joliet_path ) log_block_size = self . joliet_vd . logical_block_size ( ) r... | An internal method to add a joliet directory to the ISO . |
20,378 | def _rm_joliet_dir ( self , joliet_path ) : if self . joliet_vd is None : raise pycdlibexception . PyCdlibInternalError ( 'Tried to remove joliet dir from non-Joliet ISO' ) log_block_size = self . joliet_vd . logical_block_size ( ) joliet_child = self . _find_joliet_record ( joliet_path ) num_bytes_to_remove = joliet_c... | An internal method to remove a directory from the Joliet portion of the ISO . |
20,379 | def _get_entry ( self , iso_path , rr_path , joliet_path ) : if self . _needs_reshuffle : self . _reshuffle_extents ( ) rec = None if joliet_path is not None : rec = self . _find_joliet_record ( joliet_path ) elif rr_path is not None : rec = self . _find_rr_record ( rr_path ) elif iso_path is not None : rec = self . _f... | Internal method to get the directory record for a particular path . |
20,380 | def _get_udf_entry ( self , udf_path ) : if self . _needs_reshuffle : self . _reshuffle_extents ( ) ( ident_unused , rec ) = self . _find_udf_record ( utils . normpath ( udf_path ) ) if rec is None : raise pycdlibexception . PyCdlibInvalidInput ( 'Cannot get entry for empty UDF File Entry' ) return rec | Internal method to get the UDF File Entry for a particular path . |
20,381 | def _create_dot ( self , vd , parent , rock_ridge , xa , file_mode ) : dot = dr . DirectoryRecord ( ) dot . new_dot ( vd , parent , vd . sequence_number ( ) , rock_ridge , vd . logical_block_size ( ) , xa , file_mode ) self . _add_child_to_dr ( dot , vd . logical_block_size ( ) ) | An internal method to create a new dot Directory Record . |
20,382 | def _create_dotdot ( self , vd , parent , rock_ridge , relocated , xa , file_mode ) : dotdot = dr . DirectoryRecord ( ) dotdot . new_dotdot ( vd , parent , vd . sequence_number ( ) , rock_ridge , vd . logical_block_size ( ) , relocated , xa , file_mode ) self . _add_child_to_dr ( dotdot , vd . logical_block_size ( ) ) ... | An internal method to create a new dotdot Directory Record . |
20,383 | def open ( self , filename ) : if self . _initialized : raise pycdlibexception . PyCdlibInvalidInput ( 'This object already has an ISO; either close it or create a new object' ) fp = open ( filename , 'r+b' ) self . _managing_fp = True try : self . _open_fp ( fp ) except Exception : fp . close ( ) raise | Open up an existing ISO for inspection and modification . |
20,384 | def open_fp ( self , fp ) : if self . _initialized : raise pycdlibexception . PyCdlibInvalidInput ( 'This object already has an ISO; either close it or create a new object' ) self . _open_fp ( fp ) | Open up an existing ISO for inspection and modification . Note that the file object passed in here must stay open for the lifetime of this object as the PyCdlib class uses it internally to do writing and reading operations . If you want PyCdlib to manage this for you use open instead . |
20,385 | def get_file_from_iso ( self , local_path , ** kwargs ) : if not self . _initialized : raise pycdlibexception . PyCdlibInvalidInput ( 'This object is not yet initialized; call either open() or new() to create an ISO' ) blocksize = 8192 joliet_path = None iso_path = None rr_path = None udf_path = None num_paths = 0 for ... | A method to fetch a single file from the ISO and write it out to a local file . |
20,386 | def get_file_from_iso_fp ( self , outfp , ** kwargs ) : if not self . _initialized : raise pycdlibexception . PyCdlibInvalidInput ( 'This object is not yet initialized; call either open() or new() to create an ISO' ) blocksize = 8192 joliet_path = None iso_path = None rr_path = None udf_path = None num_paths = 0 for ke... | A method to fetch a single file from the ISO and write it out to the file object . |
20,387 | def write ( self , filename , blocksize = 32768 , progress_cb = None , progress_opaque = None ) : if not self . _initialized : raise pycdlibexception . PyCdlibInvalidInput ( 'This object is not yet initialized; call either open() or new() to create an ISO' ) with open ( filename , 'wb' ) as fp : self . _write_fp ( fp ,... | Write a properly formatted ISO out to the filename passed in . This also goes by the name of mastering . |
20,388 | def add_file ( self , filename , iso_path , rr_name = None , joliet_path = None , file_mode = None , udf_path = None ) : if not self . _initialized : raise pycdlibexception . PyCdlibInvalidInput ( 'This object is not yet initialized; call either open() or new() to create an ISO' ) num_bytes_to_add = self . _add_fp ( fi... | Add a file to the ISO . If the ISO is a Rock Ridge one then a Rock Ridge name must also be provided . If the ISO is a Joliet one then a Joliet path may also be provided ; while it is optional to do so it is highly recommended . |
20,389 | def rm_file ( self , iso_path , rr_name = None , joliet_path = None , udf_path = None ) : if not self . _initialized : raise pycdlibexception . PyCdlibInvalidInput ( 'This object is not yet initialized; call either open() or new() to create an ISO' ) iso_path_bytes = utils . normpath ( iso_path ) if not utils . starts_... | Remove a file from the ISO . |
20,390 | def get_record ( self , ** kwargs ) : if not self . _initialized : raise pycdlibexception . PyCdlibInvalidInput ( 'This object is not yet initialized; call either open() or new() to create an ISO' ) num_paths = 0 for key in kwargs : if key in [ 'joliet_path' , 'rr_path' , 'iso_path' , 'udf_path' ] : if kwargs [ key ] i... | Get the directory record for a particular path . |
20,391 | def full_path_from_dirrecord ( self , rec , rockridge = False ) : if not self . _initialized : raise pycdlibexception . PyCdlibInvalidInput ( 'This object is not yet initialized; call either open() or new() to create an ISO' ) ret = b'' if isinstance ( rec , dr . DirectoryRecord ) : encoding = 'utf-8' if self . joliet_... | A method to get the absolute path of a directory record . |
20,392 | def duplicate_pvd ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInvalidInput ( 'This object is not yet initialized; call either open() or new() to create an ISO' ) pvd = headervd . PrimaryOrSupplementaryVD ( headervd . VOLUME_DESCRIPTOR_TYPE_PRIMARY ) pvd . copy ( self . pvd ) self . pvds . ap... | A method to add a duplicate PVD to the ISO . This is a mostly useless feature allowed by Ecma - 119 to have duplicate PVDs to avoid possible corruption . |
20,393 | def clear_hidden ( self , iso_path = None , rr_path = None , joliet_path = None ) : if not self . _initialized : raise pycdlibexception . PyCdlibInvalidInput ( 'This object is not yet initialized; call either open() or new() to create an ISO' ) if len ( [ x for x in ( iso_path , rr_path , joliet_path ) if x is not None... | Clear the ISO9660 hidden attribute on a file or directory . This will cause the file or directory to show up when listing entries on the ISO . Exactly one of iso_path rr_path or joliet_path must be specified . |
20,394 | def set_relocated_name ( self , name , rr_name ) : if not self . _initialized : raise pycdlibexception . PyCdlibInvalidInput ( 'This object is not yet initialized; call either open() or new() to create an ISO' ) if not self . rock_ridge : raise pycdlibexception . PyCdlibInvalidInput ( 'Can only set the relocated name o... | Set the name of the relocated directory on a Rock Ridge ISO . The ISO must be a Rock Ridge one and must not have previously had the relocated name set . |
20,395 | def close ( self ) : if not self . _initialized : raise pycdlibexception . PyCdlibInvalidInput ( 'This object is not yet initialized; call either open() or new() to create an ISO' ) if self . _managing_fp : self . _cdfp . close ( ) self . _initialize ( ) | Close the PyCdlib object and re - initialize the object to the defaults . The object can then be re - used for manipulation of another ISO . |
20,396 | def make_arg_parser ( ) : parser = argparse . ArgumentParser ( formatter_class = argparse . RawTextHelpFormatter , usage = "vex [OPTIONS] VIRTUALENV_NAME COMMAND_TO_RUN ..." , ) make = parser . add_argument_group ( title = 'To make a new virtualenv' ) make . add_argument ( '-m' , '--make' , action = "store_true" , help... | Return a standard ArgumentParser object . |
20,397 | def get_options ( argv ) : arg_parser = make_arg_parser ( ) options , unknown = arg_parser . parse_known_args ( argv ) if unknown : arg_parser . print_help ( ) raise exceptions . UnknownArguments ( "unknown args: {0!r}" . format ( unknown ) ) options . print_help = arg_parser . print_help return options | Called to parse the given list as command - line arguments . |
20,398 | def _update_bird_conf_file ( self , operation ) : conf_updated = False prefixes = [ ] ip_version = operation . ip_version config_file = self . bird_configuration [ ip_version ] [ 'config_file' ] variable_name = self . bird_configuration [ ip_version ] [ 'variable_name' ] changes_counter = self . bird_configuration [ ip... | Update BIRD configuration . |
20,399 | def run ( self ) : if not self . services : self . log . warning ( "no service checks are configured" ) else : self . log . info ( "going to lunch %s threads" , len ( self . services ) ) if self . config . has_option ( 'daemon' , 'splay_startup' ) : splay_startup = self . config . getfloat ( 'daemon' , 'splay_startup' ... | Lunch checks and triggers updates on BIRD configuration . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.