Writes branch data to a ReST table.
506712
def write_branch_data(self, file):
        
        report = CaseReport(self.case)
        branches = self.case.branches

        col_width   = 8
        col_width_2 = col_width*2+1
        col1_width  = 7

        sep = ("=" * 7 + " ") * 3 + ("=" * col_width + " ") * 6 + "\n"

        file.write(sep)
        # Line one of column headers
        file.write("Name".center(col1_width) + " ")
        file.write("From".center(col1_width) + " ")
        file.write("To".center(col1_width) + " ")
        file.write("From Bus Inj".center(col_width_2) + " ")
        file.write("To Bus Inj".center(col_width_2) + " ")
        file.write("Loss (I^2 * Z)".center(col_width_2) + " ")
        file.write("\n")

        file.write(("-"*col1_width +" ")*3)
        file.write(("-"*col_width_2 +" ")*3 + "\n")

        # Line two of column header
        file.write("..".ljust(col1_width) + " ")
        file.write("Bus".center(col1_width) + " ")
        file.write("Bus".center(col1_width) + " ")
        file.write("P (MW)".center(col_width) + " ")
        file.write("Q (MVAr)".center(col_width) + " ")
        file.write("P (MW)".center(col_width) + " ")
        file.write("Q (MVAr)".center(col_width) + " ")
        file.write("P (MW)".center(col_width) + " ")
        file.write("Q (MVAr)".center(col_width) + " ")
        file.write("\n")

        file.write(sep)
        # Branch rows
        loss = report._loss()
        for each in branches:
            file.write(each.name[:col1_width].ljust(col1_width) + " ")
            file.write(each.from_bus.name[:col1_width].ljust(col1_width)+" ")
            file.write(each.to_bus.name[:col1_width].ljust(col1_width)+" ")
            file.write("%8.2f " % each.p_from)
            file.write("%8.2f " % each.q_from)
            file.write("%8.2f " % each.p_to)
            file.write("%8.2f " % each.q_to)
            file.write("%8.2f " % loss.real[each._i])
            file.write("%8.2f " % loss.imag[each._i])
            file.write("\n")

        # Totals
#        file.write("..".ljust(col1_width) + " ")
#        file.write(("..".ljust(col_width) + " ")*2)
#        file.write(("_"*col_width + " ")*4 + "\n")
        file.write(("..".ljust(col1_width) + " ")*3)
        file.write(("..".ljust(col_width) + " ")*3)
        file.write("*Total:*".rjust(col_width) + " ")
        pl, ql = report.losses
        file.write("%8.2f " % pl)
        file.write("%8.2f " % ql)
        file.write("\n")

        file.write(sep)

        del report
1359970
def publish(branch, full_force=False):
    """"""
    checkout(branch)
    try:
        push('--force --set-upstream origin', branch)
    except ExistingReference:
        if full_force:
            push('origin --delete', branch)
            push('--force --set-upstream origin', branch)
365728
public void writeTable(VoltTable table) throws IOException {
        int len = table.getSerializedSize();
        growIfNeeded(len);
        table.flattenToBuffer(buffer.b());
    }
1155769
private void writEventToSystemTable(String key, Delta delta, Audit audit) {
        _backingStore.update(_systemTableUnPublishedDatabusEvents, key, TimeUUIDs.newUUID(), delta, audit, WriteConsistency.GLOBAL);
    }
447039
def write_branch_data(self, file):
        
        writer = self._get_writer(file)
        writer.writerow(BRANCH_ATTRS)
        for branch in self.case.branches:
            writer.writerow([getattr(branch, a) for a in BRANCH_ATTRS])
1326996
def write(self, data):
        """"""
        while True:
            try:
                return self._sslobj.write(data)
            except SSLError:
                ex = sys.exc_info()[1]
                if ex.args[0] == SSL_ERROR_WANT_READ:
                    if self.timeout == 0.0:
                        raise
                    six.exc_clear()
                    self._io.wait_read(timeout=self.timeout, timeout_exc=_SSLErrorWriteTimeout)
                elif ex.args[0] == SSL_ERROR_WANT_WRITE:
                    if self.timeout == 0.0:
                        raise
                    six.exc_clear()
                    self._io.wait_write(timeout=self.timeout, timeout_exc=_SSLErrorWriteTimeout)
                else:
                    raise
812877
def write_toml(self, data, path=None):
        """"""
        if path is None:
            path = self.pipfile_location
        data = convert_toml_outline_tables(data)
        try:
            formatted_data = tomlkit.dumps(data).rstrip()
        except Exception:
            document = tomlkit.document()
            for section in ("packages", "dev-packages"):
                document[section] = tomlkit.container.Table()
                # Convert things to inline tables — fancy :)
                for package in data.get(section, {}):
                    if hasattr(data[section][package], "keys"):
                        table = tomlkit.inline_table()
                        table.update(data[section][package])
                        document[section][package] = table
                    else:
                        document[section][package] = tomlkit.string(data[section][package])
            formatted_data = tomlkit.dumps(document).rstrip()

        if (
            vistir.compat.Path(path).absolute()
            == vistir.compat.Path(self.pipfile_location).absolute()
        ):
            newlines = self._pipfile_newlines
        else:
            newlines = DEFAULT_NEWLINES
        formatted_data = cleanup_toml(formatted_data)
        with io.open(path, "w", newline=newlines) as f:
            f.write(formatted_data)
        # pipfile is mutated!
        self.clear_pipfile_cache()
1147348
def write_record(fo, datum, schema):
    """"""
    for field in schema['fields']:
        name = field['name']
        if name not in datum and 'default' not in field and \
                'null' not in field['type']:
            raise ValueError('no value and no default for %s' % name)
        write_data(fo, datum.get(
            name, field.get('default')), field['type'])
1313364
def dump_table(self, table, drop_statement=True):
        """"""
        create_statement = self.get_table_definition(table)
        data = self.select_all(table)
        statements = ['\n', sql_file_comment(''),
                      sql_file_comment('Table structure and data dump for {0}'.format(table)), sql_file_comment('')]
        if drop_statement:
            statements.append('\nDROP TABLE IF EXISTS {0};'.format(wrap(table)))
        statements.append('{0};\n'.format(create_statement))
        if len(data) > 0:
            statements.append('{0};'.format(insert_statement(table, self.get_columns(table), data)))
        return '\n'.join(statements)
214237
public void write(DataOutput out) throws IOException
    {
        out.writeUTF(startToken);
        out.writeUTF(endToken);
        out.writeInt(dataNodes.length);
        for (String endpoint : dataNodes)
        {
            out.writeUTF(endpoint);
        }
    }
122949
public synchronized void write(DataOutput out) throws IOException {
    jobid.write(out);
    out.writeFloat(setupProgress);
    out.writeFloat(mapProgress);
    out.writeFloat(reduceProgress);
    out.writeFloat(cleanupProgress);
    out.writeInt(runState);
    out.writeLong(startTime);
    Text.writeString(out, user);
    WritableUtils.writeEnum(out, priority);
    Text.writeString(out, schedulingInfo);
  }
1302519
@Override
    public synchronized void write(byte[] b, int off, int len) throws IOException {
        super.write(b, off, len);
        this.branch.write(b, off, len);
    }
297245
def write_collection(self, collection_id, file_content, branch, author):
        
        gh_user = branch.split('_collection_')[0]
        msg = "Update Collection '%s' via OpenTree API" % collection_id
        return self.write_document(gh_user,
                                   collection_id,
                                   file_content,
                                   branch, author,
                                   commit_msg=msg)
719526
def write(self, bucket, rows, keyed=False, as_generator=False, update_keys=None):
        

        # Check update keys
        if update_keys is not None and len(update_keys) == 0:
            message = 'Argument "update_keys" cannot be an empty list'
            raise tableschema.exceptions.StorageError(message)

        # Get table and description
        table = self.__get_table(bucket)
        schema = tableschema.Schema(self.describe(bucket))
        fallbacks = self.__fallbacks.get(bucket, [])

        # Write rows to table
        convert_row = partial(self.__mapper.convert_row, schema=schema, fallbacks=fallbacks)
        writer = Writer(table, schema, update_keys, self.__autoincrement, convert_row)
        with self.__connection.begin():
            gen = writer.write(rows, keyed=keyed)
            if as_generator:
                return gen
            collections.deque(gen, maxlen=0)
622128
def write_study(self, study_id, file_content, branch, author):
        
        gh_user = branch.split('_study_')[0]
        msg = "Update Study #%s via OpenTree API" % study_id
        return self.write_document(gh_user,
                                   study_id,
                                   file_content,
                                   branch,
                                   author,
                                   commit_msg=msg)
1372670
public void write(String... columns) throws DataUtilException {
        if(columns.length != tableColumns) {
            throw new DataUtilException("Invalid column count. Expected " + tableColumns + " but found: "
                    + columns.length);
        }
        try {
            if(currentRow == 0) {
                // capture header row
                this.headerRowColumns = columns;
                writeTop();
                writeRow(headerRowColumns);
            } else if(maxRowsPerPage > 1 && currentRow % maxRowsPerPage == 0) {
                writeBottom(true);
                currentPageNumber = (currentRow/maxRowsPerPage) + 1;
                writeTop();
                writeRow(headerRowColumns);
                currentRow += 1;
                writeRow(columns);
            } else {
                writeRow(columns);
            }
            currentRow += 1;
        } catch (Exception e) {
            throw new DataUtilException(e);
        }
    }
586324
private void writeImport(SymbolTable symTab)
    {
        assert symTab.isSharedTable();

        final int originalOffset = myBuffer.length - myOffset;

        // Write the maxId as int
        int maxId = symTab.getMaxId();
        if (maxId == 0) {
            writeByte((byte) TYPE_POS_INT);
        } else {
            writeUInt(maxId);
            writePrefix(TYPE_POS_INT,
                        myBuffer.length - myOffset - originalOffset);
        }

        // Write the "max_id" field name
        writeByte((byte) (0x80 | MAX_ID_SID));

        final int maxIdOffset = myBuffer.length - myOffset;

        // Write the version as int (version will be at least one)
        int version = symTab.getVersion();
        writeUInt(version);
        writePrefix(TYPE_POS_INT, myBuffer.length - myOffset - maxIdOffset);

        // Write the "version" field name
        writeByte((byte) (0x80 | VERSION_SID));

        // Write the name as string
        String name = symTab.getName();
        writeIonStringContent(name);

        // Write the "name" field name
        writeByte((byte) (0x80 | NAME_SID));

        // Write the struct prefix
        writePrefix(TYPE_STRUCT, myBuffer.length - myOffset - originalOffset);
    }