xnn.common.config.options.ModelOptions#

class xnn.common.config.options.ModelOptions(values=(), read=None, defaults=None)[source]#

Bases: dict

A copy of ModelConfig.extra that records which options are read.

Reading a key (options[key], get(), key in options, pop(), setdefault()) adds it to read, and the default get() returns for a missing key to defaults; both are shared with the copies made by copy() and model_options().

Parameters:
  • values (mapping, optional) – The options.

  • read (set or None, optional) – The set to record reads in; None starts a new one.

  • defaults (dict or None, optional) – The dict to record defaults in; None starts a new one.

get(key, default=None)[source]#

Return the value for key if key is in the dictionary, else default.

pop(k[, d]) → v, remove specified key and return the corresponding value.[source]#

If the key is not found, return the default if given; otherwise, raise a KeyError.

setdefault(key, default=None)[source]#

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

copy() → a shallow copy of D[source]#
Return type:

ModelOptions

resolved()[source]#

The options given and the defaults used for the others.

Only defaults that a config file can hold (None, numbers, strings and lists or dicts of those) are included; tuples become lists.

Return type:

dict

unread()[source]#

The options nothing has read, sorted.

CONFIG_KEYS and options set to None (not set) are excepted.

Return type:

list[str]