Each order needs to have all it's details filled with default value,
        or None, in case those are not already filled.
335974
def _prepare_orders(self, orders):
        

        for detail in PAYU_ORDER_DETAILS:
            if not any([detail in order for order in orders]):
                for order in orders:
                    order[detail] = PAYU_ORDER_DETAILS_DEFAULTS.get(detail, None)

        return orders
116217
def _ensure_values(data: Mapping[str, Any]) -> Tuple[Dict[str, Any], bool]:
    
    to_return = {}
    should_write = False
    for keyname, typekind, default in REQUIRED_DATA:
        if keyname not in data:
            LOG.debug(f"Defaulted config value {keyname} to {default}")
            to_return[keyname] = default
            should_write = True
        elif not isinstance(data[keyname], typekind):
            LOG.warning(
                f"Config value {keyname} was {type(data[keyname])} not"
                f" {typekind}, defaulted to {default}")
            to_return[keyname] = default
            should_write = True
        else:
            to_return[keyname] = data[keyname]
    return to_return, should_write
1104506
def default_value(self, default_value):
        
        # For custom value
        if default_value not in self.default_values:
            if len(self.default_labels) == len(self.default_values):
                self.default_values[-1] = default_value
            else:
                self.default_values.append(default_value)

        self._default_value = default_value
1087705
def set_defaults(self):
        
        for key, val in self.c_default.items():
            self._dict[key] = val
744790
def _check_default_index(items, default_index):
    ''''''
    num_items = len(items)
    if default_index is not None and not isinstance(default_index, int):
        raise TypeError("The default index ({}) is not an integer".format(default_index))
    if default_index is not None and default_index >= num_items:
        raise ValueError("The default index ({}) >= length of the list ({})".format(default_index, num_items))
    if default_index is not None and default_index < 0:
        raise ValueError("The default index ({}) < 0.".format(default_index))
    if default_index is not None and not items[default_index]:
        raise ValueError("The default index ({}) points to an empty item.".format(default_index))
597104
def fill_with_defaults(process_input, input_schema):
    """"""
    for field_schema, fields, path in iterate_schema(process_input, input_schema):
        if 'default' in field_schema and field_schema['name'] not in fields:
            dict_dot(process_input, path, field_schema['default'])
1041567
public function requireDefaultRecords()
    {
        $records = (array) Config::inst()->get(get_class($this), 'default_records');
        foreach ($records as $name) {
            $type = TaxonomyType::get()->filter('Name', $name)->first();
            if (!$type) {
                $type = TaxonomyType::create(array('Name' => $name));
                $type->write();
            }
        }
    }
663999
private void populateDefaultData(FieldItem[] defaultData)
   {
      for (FieldItem item : defaultData)
      {
         m_map.put(item.getType(), item);
      }
   }
1142014
def _all_default(d, default, seen=None):
    
    if default is None:
        return
    if _get(default, CLASS) is Data:
        default = object.__getattribute__(default, SLOT)  # REACH IN AND GET THE dict
        # Log = _late_import()
        # Log.error("strictly dict (or object) allowed: got {{type}}", type=_get(default, CLASS).__name__)

    for k, default_value in default.items():
        default_value = unwrap(default_value)  # TWO DIFFERENT Dicts CAN SHARE id() BECAUSE THEY ARE SHORT LIVED
        existing_value = _get_attr(d, [k])

        if existing_value == None:
            if default_value != None:
                if _get(default_value, CLASS) in data_types:
                    df = seen.get(id(default_value))
                    if df is not None:
                        _set_attr(d, [k], df)
                    else:
                        copy_dict = {}
                        seen[id(default_value)] = copy_dict
                        _set_attr(d, [k], copy_dict)
                        _all_default(copy_dict, default_value, seen)
                else:
                    # ASSUME PRIMITIVE (OR LIST, WHICH WE DO NOT COPY)
                    try:
                        _set_attr(d, [k], default_value)
                    except Exception as e:
                        if PATH_NOT_FOUND not in e:
                            get_logger().error("Can not set attribute {{name}}", name=k, cause=e)
        elif is_list(existing_value) or is_list(default_value):
            _set_attr(d, [k], None)
            _set_attr(d, [k], listwrap(existing_value) + listwrap(default_value))
        elif (hasattr(existing_value, "__setattr__") or _get(existing_value, CLASS) in data_types) and _get(default_value, CLASS) in data_types:
            df = seen.get(id(default_value))
            if df is not None:
                _set_attr(d, [k], df)
            else:
                seen[id(default_value)] = existing_value
                _all_default(existing_value, default_value, seen)
434708
def _check_default(value, parameter, default_chars):
    ''''''
    # not using a set here because it fails when value is unhashable
    if value in default_chars:
        if parameter.default is inspect.Parameter.empty:
            raise ValueError('Value was empty, but no default value is given in view function for parameter: {} ({})'.format(parameter.position, parameter.name))
        return parameter.default
    return value
732436
def set_defaults(self):
        
        for key, value in self.spec.items():
            setattr(self, key.upper(), value.get("default", None))
26124
public function requireDefaultRecords() {
		parent::requireDefaultRecords();

		if(Site::get()->count() > 0) {
			return;
		}

		$site = Site::create();
		$site->Title = _t('Multisites.DEFAULTSITE', 'Default Site');
		$site->IsDefault = true;
		$site->FolderID = Folder::find_or_make('default-site')->ID;
		$site->write();
		$site->publish('Stage', 'Live');

		DB::alteration_message('Default site created', 'created');

		$pages = SiteTree::get()->exclude('ID', $site->ID)->filter('ParentID', 0);
		$count = count($pages);
		if ($count > 0) {
			foreach($pages as $page) {
				$page->ParentID = $site->ID;
				$page->write();
				if ($page->isPublished()) {
					$page->publish('Stage', 'Live');
				}
			}

			DB::alteration_message("Moved $count existing pages under new default site.", 'changed');
		}
	}
97670
protected function supplementRequestWithDefaults()
    {
        parent::supplementRequestWithDefaults();

        if (empty($this->request->getFingerprint())) {
            $this->request->setFingerprint( $this->defaults->getFingerprint() );
        }

        if (empty($this->request->getPath())) {
            $this->request->setPath( $this->defaults->getPath() );
        }

        if (empty($this->request->getLocalPath())) {
            $this->request->setLocalPath( $this->defaults->getLocalPath() );
        }

        if (empty($this->request->getPattern())) {
            $this->request->setPattern( $this->defaults->getPattern() );
        }

        if (empty($this->request->getFilesCallback())) {
            $this->request->setFilesCallback( $this->defaults->getFilesCallback() );
        }

        if (empty($this->request->getDoCleanup())) {
            $this->request->setDoCleanup( $this->defaults->getDoCleanup() );
        }
    }
1289050
protected function fillDataForEmpty()
    {
        // Fill field references if they are empty
        $fields = [];

        // Add columns for attributes
        foreach ($this->info->attributes as $attribute) {

            if ($attribute->hidden || ! $this->shouldAttributeBeEditableByDefault($attribute, $this->info)) {
                continue;
            }

            $fields[ $attribute->name ] = $this->makeModelFormFieldDataForAttributeData($attribute);
        }


        // Add fields for relations
        foreach ($this->info->relations as $relation) {

            $fields[ $relation->name ] = $this->makeModelFormFieldDataForRelationData($relation);
        }


        $this->info->form->fields = $fields;
    }
574853
def is_default(self):
        """"""
        if not self.get_applicable_values():
            return True

        if self.get_value().is_default:
            return True

        return False
1239688
def _struct_has_defaults(self, struct):
        """"""
        return [
            f for f in struct.all_fields
            if f.has_default or is_nullable_type(f.data_type)
        ]
760737
protected function apply_defaults() {
        parent::apply_defaults();

        // We want to set the solr_filegroupingid to id if it isn't set.
        if (!isset($this->data['solr_filegroupingid'])) {
            $this->data['solr_filegroupingid'] = $this->data['id'];
        }
    }