Get the default value of the field.
181164
def default_value(self):
        """"""
        if self.name in tsdb_coded_attributes:
            return tsdb_coded_attributes[self.name]
        elif self.datatype == ':integer':
            return -1
        else:
            return ''
460611
def get_default(name, value):
    """"""
    return os.environ.get('EXAMPLE_{}'.format(name.upper()), value)
1320288
public function set_value($field = '', $default = '')
    {
        if (!isset($this->_field_data[$field], $this->_field_data[$field]['postdata'])) {
            return $default;
        }
        return $this->_field_data[$field]['postdata'];
    }
526995
def default(self, value):
        
        if isinstance(value, messages.Enum):
            return str(value)

        if six.PY3 and isinstance(value, bytes):
            return value.decode('utf8')

        if isinstance(value, messages.Message):
            result = {}
            for field in value.all_fields():
                item = value.get_assigned_value(field.name)
                if item not in (None, [], ()):
                    result[field.name] = (
                        self.__protojson_protocol.encode_field(field, item))
            # Handle unrecognized fields, so they're included when a message is
            # decoded then encoded.
            for unknown_key in value.all_unrecognized_fields():
                unrecognized_field, _ = value.get_unrecognized_field_info(
                    unknown_key)
                # Unknown fields are not encoded as they should have been
                # processed before we get to here.
                result[unknown_key] = unrecognized_field
            return result

        return super(MessageJSONEncoder, self).default(value)
1026053
def get_default(self, ctx):
        """"""
        # Otherwise go with the regular default.
        if callable(self.default):
            rv = self.default()
        else:
            rv = self.default
        return self.type_cast_value(ctx, rv)
260631
def value(self):
        """"""
        field_vals = None
        field_names = self.fields_select.names()
        fcount = len(field_names)
        if fcount:
            d = self._query('get_one')
            if d:
                field_vals = [d.get(fn, None) for fn in field_names]
                if fcount == 1:
                    field_vals = field_vals[0]

        else:
            raise ValueError("no select fields were set, so cannot return value")

        return field_vals
255812
public static DefaultValueFunction defaultValue(Field field, Object defaultValue) {

		Assert.notNull(field, "Field must not be 'null' for default value operation.");

		return new DefaultValueFunction(field, defaultValue);
	}
637292
def normalize_field(self, value):
        
        if self.default is not None:
            if value is None or value == '':
                value = self.default
        return value
1276433
private CodeBlock getDefaultValue(Property prop, FieldSpec field) {
    if (field.type.isPrimitive()) {
      String defaultValue = getDefaultPrimitiveValue(field.type);
      if (defaultValue != null) {
        return CodeBlock.of("$L", defaultValue);
      } else {
        return CodeBlock.of("$T.valueOf(null)", field.type);
      }
    }
    if (prop.nullable()) {
      return null;
    }
    TypeMirror type = prop.element.getReturnType();
    if (type.getKind() != TypeKind.DECLARED) {
      return null;
    }
    TypeElement typeElement = MoreTypes.asTypeElement(type);
    if (typeElement == null) {
      return null;
    }

    return null;
  }
771847
public int getValueAsIntWithDefault(String keyIdField, int defaultVal) throws IOException {
        if(keyToValue.containsKey(keyIdField)) {
            return Integer.parseInt(getValue(keyIdField));
        }
        else return defaultVal;
    }
834016
public function get_default_value() {
        $defaultvalue = $this->get_field()->get_configdata_property('defaultvalue');
        if ('' . $defaultvalue !== '') {
            $options = field_controller::get_options_array($this->get_field());
            $key = array_search($defaultvalue, $options);
            if ($key !== false) {
                return $key;
            }
        }
        return 0;
    }
220238
public Object getFieldDefaultValue(TypeElement type, String name) {
		return this.defaultValues.computeIfAbsent(type, this::resolveFieldValues)
				.get(name);
	}
1367800
def GetDefault(self, fd=None, default=None):
    """"""
    if callable(self.default):
      return self.default(fd)

    if self.default is not None:
      # We can't return mutable objects here or the default might change for all
      # objects of this class.
      if isinstance(self.default, rdfvalue.RDFValue):
        default = self.default.Copy()
        default.attribute_instance = self
        return self(default)
      else:
        return self(self.default)

    if isinstance(default, rdfvalue.RDFValue):
      default = default.Copy()
      default.attribute_instance = self

    return default
1180180
def default(self, value):
        """"""
        if isinstance(value, ObjectId):
            return str(value)
        return super(ElasticJSONSerializer, self).default(value)
823212
def get(self, field_name, default=None):
        """"""
        checkFieldName(field_name)
        return self.data.get(field_name, default)
985792
def get_default(self):
        """"""
        length = len(self)
        if length == 0:
            return None
        elif length == 1:
            return self[0]
        else:
            return sorted(self, key=attrgetter('id'))[0]
1247590
def get_field(field):
    """"""
    if isinstance(field, djmodels.fields.Field):
        return field
    elif isinstance(field, basestring):
        field = field.split('.')
        if len(field) == 3:
            model = get_model(app=field[0], model=field[1])
        elif len(field) == 2:
            model = get_model(app=DEFAULT_APP, model=field[0])
        else:
            return None
            raise NotImplementedError("Unknown default model name. Don't know where to look for field %s" % '.'.join(field)) 
        field = model._meta.get_field(field[-1])
    return field