Truncates fields values for the given model. Prompts for a new
        value if truncation occurs.
960675
def trunc(self, model, prompt, **fields):
        
        for field_name, value in fields.items():
            field = model._meta.get_field(field_name)
            max_length = getattr(field, "max_length", None)
            if not max_length:
                continue
            elif not prompt:
                fields[field_name] = value[:max_length]
                continue
            while len(value) > max_length:
                encoded_value = value.encode("utf-8")
                new_value = input("The value for the field %s.%s exceeds "
                    "its maximum length of %s chars: %s\n\nEnter a new value "
                    "for it, or press return to have it truncated: " %
                    (model.__name__, field_name, max_length, encoded_value))
                value = new_value if new_value else value[:max_length]
            fields[field_name] = value
        return fields
432810
@Initialize(distributed = false)
    public void truncateIfNecesary() {
        if (truncateTable) {
            final UpdateableDatastoreConnection con = datastore.openConnection();
            try {
                final SchemaNavigator schemaNavigator = con.getSchemaNavigator();

                final Table table = schemaNavigator.convertToTable(schemaName, tableName);

                final UpdateableDataContext dc = con.getUpdateableDataContext();
                dc.executeUpdate(new UpdateScript() {
                    @Override
                    public void run(UpdateCallback callback) {
                        final RowDeletionBuilder delete = callback.deleteFrom(table);
                        if (logger.isInfoEnabled()) {
                            logger.info("Executing truncating DELETE operation: {}", delete.toSql());
                        }
                        delete.execute();
                    }
                });
            } finally {
                con.close();
            }
        }
    }
40248
private void truncateUncommittedEntries() {
    if (type() == CopycatServer.State.PASSIVE) {
      context.getLog().truncate(Math.min(context.getCommitIndex(), context.getLog().lastIndex()));
    }
  }
1146008
public function setExtraModelValues(array $fields, &$model)
    {
        //make sure the relationships are loaded
        foreach ($fields as $name => $field) {
            if ($field->getOption('relationship')) {
                $this->setModelRelationship($model, $field);
            }

            //if this is a setter field, unset it
            if ($field->getOption('setter')) {
                $model->__unset($name);
            }
        }
    }
333169
def model_fields(model, allow_pk=False, only=None, exclude=None,
                 field_args=None, converter=None):
    
    converter = converter or ModelConverter()
    field_args = field_args or {}

    model_fields = list(model._meta.sorted_fields)
    if not allow_pk:
        model_fields.pop(0)

    if only:
        model_fields = [x for x in model_fields if x.name in only]
    elif exclude:
        model_fields = [x for x in model_fields if x.name not in exclude]

    field_dict = {}
    for model_field in model_fields:
        name, field = converter.convert(
            model,
            model_field,
            field_args.get(model_field.name))
        field_dict[name] = field

    return field_dict
642081
static void truncate(CallInfo callInfo, Table table) {
    final DB db = table.getDB();   
    db.access(callInfo, () -> {
      String sql = "TRUNCATE TABLE " + table.getName();
      table.setDirtyStatus(true);
      db.logSetup(callInfo, sql);
      try (WrappedStatement ws = db.compile(sql)) {
        ws.getStatement().execute();
      }
      return 0;
    });

  }
605205
protected function _truncate()
    {
        if (!$this->getLimit()->isNull()) {
            if (is_null($this->getLimit()->getCount())) {
                $this->_output = array_splice($this->_output, $this->getLimit()->getStart());
            } else {
                $this->_output = array_splice($this->_output, $this->getLimit()->getStart(), $this->getLimit()->getCount());
            }
        }
    }
218879
def truncate(self, rev: int) -> None:
        """"""
        self.seek(rev)
        self._keys.difference_update(map(get0, self._future))
        self._future = []
        if not self._past:
            self._beginning = None
596729
def del_fields(self, *names):
        """"""
        cls = type(self)
        self.__class__ = cls
        for n in names:
            # don't raise error if a field is absent
            if isinstance(getattr(cls, n, None), DataField):
                if n in self._field_values:
                    del self._field_values[n]
                delattr(cls, n)
205540
def truncate(message, limit=500):
    
    if len(message) > limit:
        trc_msg = ''.join([message[:limit // 2 - 2],
                           ' .. ',
                           message[len(message) - limit // 2 + 2:]])
    else:
        trc_msg = message
    return trc_msg
1229674
def truncate(self, index, chain):
        
        self._trace[chain] = self._trace[chain][:index]
954018
public function truncate()
    {
        if ($this->tableExist($this->tableName)) {
            $this->dbHandler->exec('TRUNCATE ' . $this->tableName);
        }
    }
836123
def prepend_model(self, value, model):
        
        if '.' not in value:
            direction = ''
            if value.startswith('-'):
                value = value[1:]
                direction = '-'
            value = '%s%s.%s' % (direction, model, value)
        return value
1282274
public void revert() {
		for (Iterator i = children.iterator(); i.hasNext();) {
			((FormModel) i.next()).revert();
		}
		// this will cause all buffered value models to revert
		commitTrigger.revert();
		// this will then go back and revert all unbuffered value models
		for (Iterator i = mediatingValueModels.values().iterator(); i.hasNext();) {
			((DirtyTrackingValueModel) i.next()).revertToOriginal();
		}
	}
701924
def truncate(value: Decimal, n_digits: int) -> Decimal:
    """"""
    return Decimal(math.trunc(value * (10 ** n_digits))) / (10 ** n_digits)
1246609
public void clearValues(String fieldName) {
        Utils.require(!Utils.isEmpty(fieldName), "fieldName");
        m_valueMap.remove(fieldName);
        m_valueRemoveMap.remove(fieldName);
    }
1116975
public void truncate(long newTruncationPoint) {
        if (newTruncationPoint < getFirstDrId()) {
            return;
        }
        final Iterator<Range<Long>> iter = m_map.asRanges().iterator();
        while (iter.hasNext()) {
            final Range<Long> next = iter.next();
            if (end(next) < newTruncationPoint) {
                iter.remove();
            } else if (next.contains(newTruncationPoint)) {
                iter.remove();
                m_map.add(range(newTruncationPoint, end(next)));
                return;
            } else {
                break;
            }
        }
        m_map.add(range(newTruncationPoint, newTruncationPoint));
    }