Generate a string representing the Rock Ridge Sparse File record.

        Parameters:
         None.
        Returns:
         String containing the Rock Ridge record.
487276
def record(self):
        # type: () -> bytes
        '''
        
        '''
        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 self.table_depth is not None:
            ret += struct.pack('=LLLLB', self.virtual_file_size_high, utils.swab_32bit(self.virtual_file_size_high), self.virtual_file_size_low, utils.swab_32bit(self.virtual_file_size_low), self.table_depth)
        else:
            ret += struct.pack('=LL', self.virtual_file_size_low, utils.swab_32bit(self.virtual_file_size_low))

        return ret
501794
def parse(self, rrstr):
        # type: (bytes) -> None
        '''
        
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('PL record already initialized!')

        # We assume that the caller has already checked the su_entry_version,
        # so we don't bother.

        (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():
            raise pycdlibexception.PyCdlibInvalidISO('Invalid length on rock ridge extension')
        if parent_log_block_num_le != utils.swab_32bit(parent_log_block_num_be):
            raise pycdlibexception.PyCdlibInvalidISO('Little endian block num does not equal big endian; corrupt ISO')
        self.parent_log_block_num = parent_log_block_num_le

        self._initialized = True
1111661
def encode(self):
        

        blob = bytearray()

        for record in self.records:
            blob += record.encode()

        header = struct.pack("<LL", self.SCRIPT_MAGIC, len(blob) + self.SCRIPT_HEADER_LENGTH)
        blob = header + blob

        sha = hashlib.sha256()
        sha.update(blob)
        hash_value = sha.digest()[:16]

        return bytearray(hash_value) + blob
389337
def format(self, record):
    """"""
    super(CliFormatter, self).format(record)
    localized_time = datetime.datetime.fromtimestamp(record.created)
    terse_time = localized_time.strftime(u'%H:%M:%S')
    terse_level = record.levelname[0]
    terse_name = record.name.split('.')[-1]
    match = RECORD_LOGGER_RE.match(record.name)
    if match:
      # Figure out which OpenHTF subsystem the record came from.
      subsys_match = SUBSYSTEM_LOGGER_RE.match(record.name)
      if subsys_match:
        terse_name = '<{subsys}: {id}>'.format(
            subsys=subsys_match.group('subsys'),
            id=subsys_match.group('id'))
      else:
        # Fall back to using the last five characters of the test UUID.
        terse_name = '<test %s>' % match.group('test_uid')[-5:]
    return '{lvl} {time} {logger} - {msg}'.format(lvl=terse_level,
                                                  time=terse_time,
                                                  logger=terse_name,
                                                  msg=record.message)
1335541
def record(self):
        # type: () -> bytes
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('CL record not yet initialized!')

        return b'CL' + struct.pack('=BBLL', RRCLRecord.length(), SU_ENTRY_VERSION, self.child_log_block_num, utils.swab_32bit(self.child_log_block_num))
919361
def generate_records(self, infile):
        

        state = 0
        record = {}

        for item in self.generate_lines(infile):

            line = item['line']
            heading = item['heading']
            
            # any Markdown heading is just a caption, no image
            if heading:
                record['heading'] = True
                record['caption'] = line[1:].strip()

                state = 'caption'
                continue

            if not line[0].isspace():
                # at a potential image
                if state == 'caption':
                    yield record
                    record = {}
                    state = 0

            if state == 'caption':
                record['caption'] += '\n' + line[:-1]
                continue

            fields = line.split(',')

            # nothing there, carry on
            if not fields: continue

            image = fields[0].strip()

            if not image: continue

            record['image'] = image

            try:
                time = float(fields[1])
            except:
                time = 0

            record['time'] = time

            try:
                caption = fields[2].strip()
            except:
                caption = None

            if caption:
                record['caption'] = caption

            # yield it if we have anything
            if record:
                yield record
                record = {}
1037177
def __prepare_record(self, record, enabled_fields):
        """"""
        message = record.getMessage()
        if hasattr(record, 'prefix'):
            message = "{}{}".format((str(record.prefix) + ' ') if record.prefix else '', message)

        obj = {
            'name': record.name,
            'asctime': self.formatTime(record, self.datefmt),
            'created': record.created,
            'msecs': record.msecs,
            'relativeCreated': record.relativeCreated,
            'levelno': record.levelno,
            'levelname': self._level_names[record.levelname],
            'thread': record.thread,
            'threadName': record.threadName,
            'process': record.process,
            'pathname': record.pathname,
            'filename': record.filename,
            'module': record.module,
            'lineno': record.lineno,
            'funcName': record.funcName,
            'message': message,
            'exception': record.exc_info[0].__name__ if record.exc_info else None,
            'stacktrace': record.exc_text,
        }

        if not isinstance(enabled_fields, list):
            enabled_fields = [str(enabled_fields)]

        ef = {}
        for item in enabled_fields:
            if not isinstance(item, (str, tuple)):
                continue
            if not isinstance(item, tuple):
                ef[item] = item
            else:
                ef[item[0]] = item[1]

        result = {}
        for key, val in obj.items():
            if key in ef:
                result[ef[key]] = val

        return result
1314886
def record(index)
      seek_to_record(index)
      return nil if deleted_record?

      DBF::Record.new(@data.read(record_length), columns, version, @memo)
    end
402216
public static String createXMLStringRecord(Record record)
    {
        String string = DBConstants.BLANK;

        DocumentBuilder db = Utility.getDocumentBuilder();
        DocumentBuilder stringdb = Utility.getDocumentBuilder();
        Document doc = null;
        synchronized (db)
        {
            doc = db.newDocument();

            Element elRoot = (Element)doc.createElement(ROOT_TAG);
            doc.appendChild(elRoot);
            try   {
                XmlInOut.enableAllBehaviors(record, false, true); // Disable file behaviors
    
                createXMLRecord(stringdb, record, doc, elRoot);
    
                elRoot.appendChild(doc.createTextNode(XmlUtilities.NEWLINE));
            } catch (DBException ex)    {
                ex.printStackTrace();
                return DBConstants.BLANK;
            }
        }
        try   {
            StringWriter out = new StringWriter();  //, MIME2Java.convert("UTF-8"));

            // Use a Transformer for output
            TransformerFactory tFactory = TransformerFactory.newInstance();
            Transformer transformer = tFactory.newTransformer();

            DOMSource source = new DOMSource(doc);
            StreamResult result = new StreamResult(out);
            transformer.transform(source, result);
            out.close();
            string = out.toString();

            int iStartString = string.indexOf("<" + ROOT_TAG + ">") + 3 + ROOT_TAG.length();
            int iEndString = string.indexOf("</" + ROOT_TAG + ">");
            if (iStartString >= iEndString)
                string = DBConstants.BLANK;
            else
                string = string.substring(iStartString, iEndString);
        } catch (TransformerConfigurationException tce) {
            // Error generated by the parser
            tce.printStackTrace();
        } catch (TransformerException te) {
            // Error generated by the parser
            te.printStackTrace();
        } catch (Exception ex)  {
            ex.printStackTrace();
        }
        XmlInOut.enableAllBehaviors(record, true, true);
        return string;
    }
219328
def get_file_mode(self):
        # type: () -> int
        '''
        
        '''
        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 self.ce_entries.px_record.posix_file_mode

        return self.dr_entries.px_record.posix_file_mode
543374
def parse(self, rrstr):
        # type: (bytes) -> None
        '''
        
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('CL record already initialized!')

        # We assume that the caller has already checked the su_entry_version,
        # so we don't bother.

        (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():
            raise pycdlibexception.PyCdlibInvalidISO('Invalid length on rock ridge extension')

        if child_log_block_num_le != utils.swab_32bit(child_log_block_num_be):
            raise pycdlibexception.PyCdlibInvalidISO('Little endian block num does not equal big endian; corrupt ISO')
        self.child_log_block_num = child_log_block_num_le

        self._initialized = True
696761
def records(self):
        
        first = True
        with as_handle(self._filename) as fp:
            for record in NCBIXML.parse(fp):
                if first:
                    self.params = self._convertBlastParamsToDict(record)
                    first = False
                yield record
808041
public int handleGetRawRecordData(Rec record)
    {
        int iErrorCode = Constant.NORMAL_RETURN;
        record = this.setNodeIndex(RESET_INDEX, record);   // Being careful
        int iNodeCount = 1;
        if (this.getNodeType() == MessageRecordDesc.NON_UNIQUE_NODE)
            iNodeCount = this.getMessage().getNodeCount(this.getFullKey(null));
        for (int index = 1; index <= iNodeCount; index++)
        {
            if (this.getNodeType() == MessageRecordDesc.NON_UNIQUE_NODE)
                record = this.setNodeIndex(index, record);
            
            iErrorCode = super.handleGetRawRecordData(record);
            
            if (iErrorCode != Constant.NORMAL_RETURN)
                break;
        }
        if (this.getNodeType() == MessageRecordDesc.NON_UNIQUE_NODE)
            this.setNodeIndex(END_OF_NODES, record);
        return iErrorCode;
    }
971728
def format(self, record):
        '''
        
        '''
        formatted_record = super(ExcInfoOnLogLevelFormatMixIn, self).format(record)
        exc_info_on_loglevel = getattr(record, 'exc_info_on_loglevel', None)
        exc_info_on_loglevel_formatted = getattr(record, 'exc_info_on_loglevel_formatted', None)
        if exc_info_on_loglevel is None and exc_info_on_loglevel_formatted is None:
            return formatted_record

        # If we reached this far it means the log record was created with exc_info_on_loglevel
        # If this specific handler is enabled for that record, then we should format it to
        # include the exc_info details
        if self.level > exc_info_on_loglevel:
            # This handler is not enabled for the desired exc_info_on_loglevel, don't include exc_info
            return formatted_record

        # If we reached this far it means we should include exc_info
        if not record.exc_info_on_loglevel_instance and not exc_info_on_loglevel_formatted:
            # This should actually never occur
            return formatted_record

        if record.exc_info_on_loglevel_formatted is None:
            # Let's cache the formatted exception to avoid recurring conversions and formatting calls
            if self.formatter is None:  # pylint: disable=access-member-before-definition
                self.formatter = logging._defaultFormatter
            record.exc_info_on_loglevel_formatted = self.formatter.formatException(
                record.exc_info_on_loglevel_instance
            )

        # Let's format the record to include exc_info just like python's logging formatted does
        if formatted_record[-1:] != '\n':
            formatted_record += '\n'

        try:
            formatted_record += record.exc_info_on_loglevel_formatted
        except UnicodeError:
            # According to the standard library logging formatter comments:
            #
            #     Sometimes filenames have non-ASCII chars, which can lead
            #     to errors when s is Unicode and record.exc_text is str
            #     See issue 8924.
            #     We also use replace for when there are multiple
            #     encodings, e.g. UTF-8 for the filesystem and latin-1
            #     for a script. See issue 13232.
            formatted_record += record.exc_info_on_loglevel_formatted.decode(sys.getfilesystemencoding(),
                                                                             'replace')
        # Reset the record.exc_info_on_loglevel_instance because it might need
        # to "travel" through a multiprocessing process and it might contain
        # data which is not pickle'able
        record.exc_info_on_loglevel_instance = None
        return formatted_record
653090
def _record(self, entries):
        # type: (RockRidgeEntries) -> bytes
        '''
        
        '''

        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 entries.px_record is not None:
            outlist.append(entries.px_record.record(self.rr_version))

        for sl_record in entries.sl_records:
            outlist.append(sl_record.record())

        if entries.tf_record is not None:
            outlist.append(entries.tf_record.record())

        if entries.cl_record is not None:
            outlist.append(entries.cl_record.record())

        if entries.pl_record is not None:
            outlist.append(entries.pl_record.record())

        if entries.re_record is not None:
            outlist.append(entries.re_record.record())

        for es_record in entries.es_records:
            outlist.append(es_record.record())

        if entries.er_record is not None:
            outlist.append(entries.er_record.record())

        if entries.ce_record is not None:
            outlist.append(entries.ce_record.record())

        for pd_record in entries.pd_records:
            outlist.append(pd_record.record())

        if entries.st_record is not None:
            outlist.append(entries.st_record.record())

        if entries.sf_record is not None:
            outlist.append(entries.sf_record.record())

        return b''.join(outlist)
741609
def record(self, rr_version):
        # type: (str) -> bytes
        '''
        
        '''
        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_mode),
                                      self.posix_file_links,
                                      utils.swab_32bit(self.posix_file_links),
                                      self.posix_user_id,
                                      utils.swab_32bit(self.posix_user_id),
                                      self.posix_group_id,
                                      utils.swab_32bit(self.posix_group_id))]
        if rr_version == '1.12':
            outlist.append(struct.pack('=LL', self.posix_serial_number,
                                       utils.swab_32bit(self.posix_serial_number)))
        # The rr_version can never be "wrong" at this point; if it was, it would
        # have thrown an exception earlier when calling length().  So just skip
        # any potential checks here.

        return b''.join(outlist)
991753
def parse(self, rrstr):
        # type: (bytes) -> None
        '''
        
        '''
        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)

        # We assume that the caller has already checked the su_entry_version,
        # so we don't bother.

        if su_len != RRSPRecord.length():
            raise pycdlibexception.PyCdlibInvalidISO('Invalid length on rock ridge extension')
        if check_byte1 != 0xbe or check_byte2 != 0xef:
            raise pycdlibexception.PyCdlibInvalidISO('Invalid check bytes on rock ridge extension')

        self._initialized = True