Generate a string representing the Rock Ridge POSIX Device Number
        record.

        Parameters:
         None.
        Returns:
         String containing the Rock Ridge record.
762406
def record(self):
        # type: () -> bytes
        '''
        
        '''
        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_32bit(self.dev_t_low))
951399
def device_slug_to_id(slug):
    

    if not isinstance(slug, str):
        raise ArgumentError("Invalid device slug that is not a string", slug=slug)

    try:
        device_slug = IOTileDeviceSlug(slug, allow_64bits=False)
    except ValueError:
        raise ArgumentError("Unable to recognize {} as a device id".format(slug))

    return device_slug.get_id()
1324336
def _generate_ipaddressfield(self, **kwargs):
        
        field = kwargs['field']
        if field.default != NOT_PROVIDED:
            return self._generate_field_with_default(**kwargs)
        num_octets = 4
        octets = [str(random.randint(0, 255)) for n in range(num_octets)]
        return '.'.join(octets)
220690
def _decode_record(self, s, line=0):
        '''
        '''
        s = s.rstrip('\r\n')
        if not s:
            return          # empty line

        if s[0] == ':':
            try:
                bin = array('B', unhexlify(asbytes(s[1:])))
            except (TypeError, ValueError):
                # this might be raised by unhexlify when odd hexascii digits
                raise HexRecordError(line=line)
            length = len(bin)
            if length < 5:
                raise HexRecordError(line=line)
        else:
            raise HexRecordError(line=line)

        record_length = bin[0]
        if length != (5 + record_length):
            raise RecordLengthError(line=line)

        addr = bin[1]*256 + bin[2]

        record_type = bin[3]
        if not (0 <= record_type <= 5):
            raise RecordTypeError(line=line)

        crc = sum(bin)
        crc &= 0x0FF
        if crc != 0:
            raise RecordChecksumError(line=line)

        if record_type == 0:
            # data record
            addr += self._offset
            for i in range_g(4, 4+record_length):
                if not self._buf.get(addr, None) is None:
                    raise AddressOverlapError(address=addr, line=line)
                self._buf[addr] = bin[i]
                addr += 1   # FIXME: addr should be wrapped
                            # BUT after 02 record (at 64K boundary)
                            # and after 04 record (at 4G boundary)

        elif record_type == 1:
            # end of file record
            if record_length != 0:
                raise EOFRecordError(line=line)
            raise _EndOfFile

        elif record_type == 2:
            # Extended 8086 Segment Record
            if record_length != 2 or addr != 0:
                raise ExtendedSegmentAddressRecordError(line=line)
            self._offset = (bin[4]*256 + bin[5]) * 16

        elif record_type == 4:
            # Extended Linear Address Record
            if record_length != 2 or addr != 0:
                raise ExtendedLinearAddressRecordError(line=line)
            self._offset = (bin[4]*256 + bin[5]) * 65536

        elif record_type == 3:
            # Start Segment Address Record
            if record_length != 4 or addr != 0:
                raise StartSegmentAddressRecordError(line=line)
            if self.start_addr:
                raise DuplicateStartAddressRecordError(line=line)
            self.start_addr = {'CS': bin[4]*256 + bin[5],
                               'IP': bin[6]*256 + bin[7],
                              }

        elif record_type == 5:
            # Start Linear Address Record
            if record_length != 4 or addr != 0:
                raise StartLinearAddressRecordError(line=line)
            if self.start_addr:
                raise DuplicateStartAddressRecordError(line=line)
            self.start_addr = {'EIP': (bin[4]*16777216 +
                                       bin[5]*65536 +
                                       bin[6]*256 +
                                       bin[7]),
                              }
555990
def device_firmware_str(self, indent):
        
        host_build_ns = self.host_firmware_build_timestamp
        host_build_s = datetime.datetime.utcfromtimestamp(host_build_ns/1000000000) if host_build_ns != None else None
        wifi_build_ns = self.wifi_firmware_build_timestamp
        wifi_build_s = datetime.datetime.utcfromtimestamp(wifi_build_ns/1000000000) if wifi_build_ns != None else None
        s = "Host Firmware Build Timestamp: {} ({} UTC)\n".format(host_build_ns, host_build_s)
        s += indent + "Host Firmware Build Version: {}\n".format(self.host_firmware_version)
        s += indent + "Wifi Firmware Build Timestamp: {} ({} UTC)\n".format(wifi_build_ns, wifi_build_s)
        s += indent + "Wifi Firmware Build Version: {}\n".format(self.wifi_firmware_version)
        return s
881295
def format(self, record):
        
        return {
            'timestamp': int(float(record.created or time.time()) * 1000),
            'message': record.msg or '',
            'level': record.levelname or 'DEBUG',
        }
429718
def device_characteristics_str(self, indent):
        
        s = "{}\n".format(self.label)
        s += indent + "MAC Address: {}\n".format(self.mac_addr)
        s += indent + "IP Address: {}\n".format(self.ip_addr)
        s += indent + "Port: {}\n".format(self.port)
        s += indent + "Power: {}\n".format(str_map(self.power_level))
        s += indent + "Location: {}\n".format(self.location)
        s += indent + "Group: {}\n".format(self.group)
        return s
823087
function getDynamoDBSequenceNumber(record) {
  return record && record.dynamodb && record.dynamodb.SequenceNumber ? record.dynamodb.SequenceNumber : '';
}
586353
def serialize(self, pid, record, links_factory=None):
        
        return self.schema.tostring(
            self.transform_record(pid, record, links_factory))
1234605
def get_device_address(device):
    
    if device is None:
        return None
    command = ['ip', 'route', 'list', 'dev', device]
    ip_routes = subprocess.check_output(command).strip()
    for line in ip_routes.split('\n'):
        seen = ''
        for a in line.split():
            if seen == 'src':
                return a
            seen = a
    return None
340699
def parent_link_record_exists(self):
        # type: () -> bool
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('Rock Ridge extension not yet initialized')

        return self.dr_entries.pl_record is not None or self.ce_entries.pl_record is not None
1106569
def record_little_endian(self):
        # type: () -> bytes
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('Path Table Record not yet initialized')

        return self._record(self.extent_location, self.parent_directory_num)
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;
    }
170458
def device_sdr_entries(self):
        
        reservation_id = self.reserve_device_sdr_repository()
        record_id = 0

        while True:
            record = self.get_device_sdr(record_id, reservation_id)
            yield record
            if record.next_id == 0xffff:
                break
            record_id = record.next_id
415831
function getKinesisSequenceNumber(record) {
  return record && record.kinesis && record.kinesis.sequenceNumber ? record.kinesis.sequenceNumber : '';
}
361578
def new(self, mode):
        # type: (int) -> None
        '''
        
        '''
        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
154708
def to_id(self):
        
        return "%s%s%s%s%s" % (TraceId.VERSION, TraceId.DELIMITER,
                               format(self.start_time, 'x'),
                               TraceId.DELIMITER, self.__number)