List default first if it exists
1130
def list_available(cls) -> List[str]:
        """"""
        keys = list(Registrable._registry[cls].keys())
        default = cls.default_implementation

        if default is None:
            return keys
        elif default not in keys:
            message = "Default implementation %s is not registered" % default
            raise ConfigurationError(message)
        else:
            return [default] + [k for k in keys if k != default]
190639
private void checkDefaults() {
        Utils.require(m_shards != null || m_shardsRange != null, "shards or range parameter is not set");
        Utils.require(m_shards == null || m_shardsRange == null, "shards and range parameters cannot be both set");
        
        Utils.require(m_xshards == null || m_xshardsRange == null, "xshards and xrange parameters cannot be both set");
        if(m_xshards == null && m_xshardsRange == null) {
        	m_xshards = m_shards;
        	m_xshardsRange = m_shardsRange;
        }
        
        if (m_query == null) m_query = "*";
        if(m_metrics == null) m_metrics = "COUNT(*)";
    }
1104256
def ensure_list(value: Union[T, Sequence[T]]) -> Sequence[T]:
    """"""
    if value is None:
        return []
    return value if isinstance(value, list) else [value]
544634
def or_list(items: Sequence[str]) -> Optional[str]:
    """"""
    if not items:
        raise ValueError

    if len(items) == 1:
        return items[0]
    if len(items) == 2:
        return items[0] + " or " + items[1]

    *selected, last_item = items[:MAX_LENGTH]
    return ", ".join(selected) + " or " + last_item
484666
function argumentOrDefault(key) {
    var args = customizations;
    return args[key] === undefined ? _defaultParams2['default'][key] : args[key];
  }
77358
def get_first(self, status):
        

        items = self.get_all(status)

        if items:
            return list(items.items())[0][1]

        return None
1029014
def first(dmap_data, *path):
    """"""
    if not (path and isinstance(dmap_data, list)):
        return dmap_data

    for key in dmap_data:
        if path[0] in key:
            return first(key[path[0]], *path[1:])

    return None
222245
def defaults(self):
        """"""
        return {k: v.default for k, v in self.options().items()}
691540
public function first($callback = null, $default = null)
        {
            if (is_null($callback)) {
                return count($this->_items) > 0 ? Arrays::first($this->_items) : $default;
            } else {
                foreach ($this->_items as $key => $value) {
                    if (call_user_func($callback, $key, $value)) {
                        return $value;
                    }
                }

                return value($default);
            }
        }
1234256
function defaults(object, options) {
  object = object || {};
  for (var i in options) {
    if (undefined === object[i] && options.hasOwnProperty(i)) {
      object[i] = options[i];
    }
  }
  return object;
}
579000
def firsts(iterable, items=1, default=None):
    # type: (Iterable[T], int, T) -> Iterable[T]
    

    try:
        items = int(items)
    except (ValueError, TypeError):
        raise ValueError("items should be usable as an int but is currently "
                         "'{}' of type '{}'".format(items, type(items)))

    # TODO: replace this so that it returns lasts()
    if items < 0:
        raise ValueError(ww.f("items is {items} but should "
                              "be greater than 0. If you wish to get the last "
                              "items, use the lasts() function."))

    i = 0
    for i, item in zip(range(items), iterable):
        yield item

    for x in range(items - (i + 1)):
        yield default
715993
function firstOrDefault(predicate, defaultValue) {
  predicate = typeof predicate === 'function' ? predicate : util.defaultPredicate;

  for (let item of this) {
    if (predicate(item)) return item;
  }

  return defaultValue;
}
111099
def _prepare_defaults(self):
		""""""
		
		for name, field in self.__fields__.items():
			if field.assign:
				getattr(self, name)
460611
def get_default(name, value):
    """"""
    return os.environ.get('EXAMPLE_{}'.format(name.upper()), value)
896145
def is_default(self):
        
        for _, item in self.iter_items(recursive=True):
            if not item.is_default:
                return False
        return True
1043027
def setdefault(obj, field, default):
    """"""
    setattr(obj, field, getattr(obj, field, default))
885788
def set_default(self, section, option,
                    default):
        """"""
        if not self.parser.has_option(section, option):
            self.parser.set(section, option, default)