Shortcuts

ConfigDict

class mmengine.config.ConfigDict(*args, **kwargs)[源代码]

A dictionary for config which has the same interface as python’s built- in dictionary and can be used as a normal dictionary.

The Config class would transform the nested fields (dictionary-like fields) in config file into ConfigDict.

If the class attribute lazy is False, users will get the object built by LazyObject or LazyAttr, otherwise users will get the LazyObject or LazyAttr itself.

The lazy should be set to True to avoid building the imported object during configuration parsing, and it should be set to False outside the Config to ensure that users do not experience the LazyObject.

build_lazy(value)[源代码]

If class attribute lazy is False, the LazyObject will be built and returned.

参数:

value (Any) – The value to be built.

返回:

The built value.

返回类型:

Any

copy() a shallow copy of D
get(key, default=None)[源代码]

Get the value of the key. If class attribute lazy is True, the LazyObject will be built and returned.

参数:
  • key (str) – The key.

  • default (any, optional) – The default value. Defaults to None.

返回:

The value of the key.

返回类型:

Any

items()[源代码]

Yield the keys and values of the dictionary.

If class attribute lazy is False, the value of LazyObject or LazyAttr will be built and returned.

merge(other)[源代码]

Merge another dictionary into current dictionary.

参数:

other (dict) – Another dictionary.

pop(key, default=None)[源代码]

Pop the value of the key. If class attribute lazy is True, the LazyObject will be built and returned.

参数:
  • key (str) – The key.

  • default (any, optional) – The default value. Defaults to None.

返回:

The value of the key.

返回类型:

Any

to_dict()[源代码]

Convert the ConfigDict to a normal dictionary recursively, and convert the LazyObject or LazyAttr to string.

update(*args, **kwargs)[源代码]

Override this method to make sure the LazyObject will not be built during updating.

返回类型:

None

values()[源代码]

Yield the values of the dictionary.

If class attribute lazy is False, the value of LazyObject or LazyAttr will be built and returned.

Read the Docs v: latest
Versions
latest
stable
v0.10.3
v0.10.2
v0.10.1
v0.10.0
v0.9.1
v0.9.0
v0.8.5
v0.8.4
v0.8.3
v0.8.2
v0.8.1
v0.8.0
v0.7.4
v0.7.3
v0.7.2
v0.7.1
v0.7.0
v0.6.0
v0.5.0
v0.4.0
v0.3.0
v0.2.0
Downloads
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.