Write an All-Link database record.
349303
def del_record(self, mem_addr: int):
        """"""
        record = self._records.get(mem_addr)
        if not record:
            _LOGGER.error('Must load the Insteon All-Link Database record '
                          'before deleting it')
        else:
            self._prior_status = self._status
            self._status = ALDBStatus.LOADING
            mem_hi = mem_addr >> 8
            mem_lo = mem_addr & 0xff
            controller = record.control_flags.is_controller
            control_flag = ControlFlags(False, controller, True, False, False)
            addr = record.address
            addr_lo = addr.bytes[0]
            addr_mid = addr.bytes[1]
            addr_hi = addr.bytes[2]
            group = record.group
            data1 = record.data1
            data2 = record.data2
            data3 = record.data3
            userdata = Userdata({'d1': 0,
                                 'd2': 0x02,
                                 'd3': mem_hi,
                                 'd4': mem_lo,
                                 'd5': 0x08,
                                 'd6': control_flag.byte,
                                 'd7': group,
                                 'd8': addr_lo,
                                 'd9': addr_mid,
                                 'd10': addr_hi,
                                 'd11': data1,
                                 'd12': data2,
                                 'd13': data3})
            msg = ExtendedSend(self._address,
                               COMMAND_EXTENDED_READ_WRITE_ALDB_0X2F_0X00,
                               userdata=userdata)
            msg.set_checksum()
            _LOGGER.debug('writing message %s', msg)
            self._send_method(msg, self._handle_write_aldb_ack, True)
            self._load_action = LoadAction(mem_addr, 1, 0)
697334
def WriteBlobs(self, blob_id_data_map):
    """"""

    urns = {self._BlobUrn(blob_id): blob_id for blob_id in blob_id_data_map}

    mutation_pool = data_store.DB.GetMutationPool()

    existing = aff4.FACTORY.MultiOpen(
        urns, aff4_type=aff4.AFF4MemoryStreamBase, mode="r")

    for blob_urn, blob_id in iteritems(urns):
      if blob_urn in existing:
        logging.debug("Blob %s already stored.", blob_id)
        continue

      with aff4.FACTORY.Create(
          blob_urn,
          aff4.AFF4UnversionedMemoryStream,
          mode="w",
          mutation_pool=mutation_pool) as fd:
        content = blob_id_data_map[blob_id]
        fd.Write(content)

      logging.debug("Got blob %s (length %s)", blob_id.AsHexString(),
                    len(content))

    mutation_pool.Flush()
545831
def _write(self, f):
        """"""
        log.debug("writing ndef record at offset {0}".format(f.tell()))

        record_type = self.type
        record_name = self.name
        record_data = self.data
        
        if record_type == '':
            header_flags = 0; record_name = ''; record_data = ''
        elif record_type.startswith("urn:nfc:wkt:"):
            header_flags = 1; record_type = record_type[12:]
        elif re.match(r'[a-zA-Z0-9-]+/[a-zA-Z0-9-+.]+', record_type):
            header_flags = 2; record_type = record_type
        elif re.match(r'[a-zA-Z][a-zA-Z0-9+-.]*://', record_type):
            header_flags = 3; record_type = record_type
        elif record_type.startswith("urn:nfc:ext:"):
            header_flags = 4; record_type = record_type[12:]
        elif record_type == 'unknown':
            header_flags = 5; record_type = ''
        elif record_type == 'unchanged':
            header_flags = 6; record_type = ''

        type_length = len(record_type)
        data_length = len(record_data)
        name_length = len(record_name)

        if self._message_begin:
            header_flags |= 0x80
        if self._message_end:
            header_flags |= 0x40
        if data_length < 256:
            header_flags |= 0x10
        if name_length > 0:
            header_flags |= 0x08

        if data_length < 256:
            f.write(struct.pack(">BBB", header_flags, type_length, data_length))
        else:
            f.write(struct.pack(">BBL", header_flags, type_length, data_length))
        if name_length > 0:
            f.write(struct.pack(">B", name_length))

        f.write(record_type)
        f.write(record_name)
        f.write(record_data)
629887
protected void writeLogRecord(LogRecord logRecord)
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "writeLogRecord", logRecord);

        _activeFile.writeLogRecord(logRecord);

        if (tc.isEntryEnabled())
            Tr.exit(tc, "writeLogRecord");
    }
999500
def write_all(self, data):
        
        self._set_cursor_x(0)
        self._set_cursor_y(0)

        self.DC.on()

        self._write(data)
883355
public void write(Object[] record) throws IOException, DbaseFileException {

		if (record.length != header.getNumFields()) {
			throw new DbaseFileException("Wrong number of fields "
					+ record.length + " expected " + header.getNumFields());
		}

		buffer.position(0);

		// put the 'not-deleted' marker
		buffer.put((byte) ' ');

		for (int i = 0; i < header.getNumFields(); i++) {
			String fieldString = fieldString(record[i], i);
			if (header.getFieldLength(i) != fieldString
					.getBytes(charset.name()).length) {
				buffer.put(new byte[header.getFieldLength(i)]);
			} else {
				buffer.put(fieldString.getBytes(charset.name()));
			}

		}

		write();
	}
430547
def write(self, data, *, mode=None, buffering=-1, encoding=None, newline=None):
        '''  '''
        if mode is None:
            mode = 'w' if isinstance(data, str) else 'wb'
        with self.open(mode=mode, buffering=buffering, encoding=encoding, newline=newline) as fp:
            return fp.write(data)
98208
def write_data(data, out_file):
    """"""
    with open(out_file, 'w') as handle_out:
        handle_out.write(json.dumps([data], skipkeys=True, indent=2))
94562
def WritePathInfos(self, client_id, path_infos):
    """"""
    try:
      self._MultiWritePathInfos({client_id: path_infos})
    except MySQLdb.IntegrityError as error:
      raise db.UnknownClientError(client_id=client_id, cause=error)
616685
def insert_recording(hw):
    """"""
    mysql = utils.get_mysql_cfg()
    connection = pymysql.connect(host=mysql['host'],
                                 user=mysql['user'],
                                 passwd=mysql['passwd'],
                                 db=mysql['db'],
                                 charset='utf8mb4',
                                 cursorclass=pymysql.cursors.DictCursor)
    try:
        cursor = connection.cursor()
        sql = ("INSERT INTO `wm_raw_draw_data` ("
               "`user_id`, "
               "`data`, "
               "`md5data`, "
               "`creation_date`, "
               "`device_type`, "
               "`accepted_formula_id`, "
               "`secret`, "
               "`ip`, "
               "`segmentation`, "
               "`internal_id`, "
               "`description` "
               ") VALUES (%s, %s, MD5(data), "
               "%s, %s, %s, %s, %s, %s, %s, %s);")
        data = (hw.user_id,
                hw.raw_data_json,
                getattr(hw, 'creation_date', None),
                getattr(hw, 'device_type', ''),
                getattr(hw, 'formula_id', None),
                getattr(hw, 'secret', ''),
                getattr(hw, 'ip', None),
                str(getattr(hw, 'segmentation', '')),
                getattr(hw, 'internal_id', ''),
                getattr(hw, 'description', ''))
        cursor.execute(sql, data)
        connection.commit()
        for symbol_id, strokes in zip(hw.symbol_stream, hw.segmentation):
            insert_symbol_mapping(cursor.lastrowid,
                                  symbol_id,
                                  hw.user_id,
                                  strokes)
        logging.info("Insert raw data.")
    except pymysql.err.IntegrityError as e:
        print("Error: {} (can probably be ignored)".format(e))
1114460
def write_ase(atoms, db_file, stdout=sys.stdout, user=None, data=None, **key_value_pairs):
    """"""
    db_ase = ase.db.connect(db_file)
    _normalize_key_value_pairs_inplace(key_value_pairs)
    id = db_ase.write(atoms, data=data, **key_value_pairs)
    stdout.write('  writing atoms to ASE db row id = {}\n'.format(id))
    unique_id = db_ase.get(id)['unique_id']
    return unique_id
1245998
void writeSQL(CallInfo callInfo, String sql) {
    Element rootNode = root(callInfo);
    writeSQL(rootNode, sql);
    flush(rootNode);
  }
688319
def write(self):
        
        # write data
        self.project_manager.writeInput(session=self.db_session,
                                        directory=self.project_directory,
                                        name=self.project_manager.name)
319408
def add_all_link_done_callback(self, callback):
        """"""
        _LOGGER.debug('Added new callback %s ', callback)
        self._cb_load_all_link_db_done.append(callback)
1320494
def write(self, handle):
        """"""
        handle.write(u"\t".join(self.columns))
        handle.write(u"\n")
        for row in self.rows:
            row.write(handle)
697014
def record(self, i=0):
        """"""
        f = self.__getFileObj(self.dbf)
        if self.numRecords is None:
            self.__dbfHeader()
        i = self.__restrictIndex(i)
        recSize = self.__recStruct.size
        f.seek(0)
        f.seek(self.__dbfHdrLength + (i * recSize))
        return self.__record(oid=i)
1061605
public static void writeAll(GatheringByteChannel ch, ByteBuffer[] bbs, int offset, int length) throws IOException
    {
        long all = 0;
        for (int ii=0;ii<length;ii++)
        {
            all += bbs[offset+ii].remaining();
        }
        int count = 0;
        while (all > 0)
        {
            long rc = ch.write(bbs, offset, length);
            if (rc == 0)
            {
                count++;
            }
            else
            {
                all -= rc;
            }
            if (count > 100)
            {
                throw new IOException("Couldn't write all.");
            }
        }
    }