cfdm.Configuration¶
- class cfdm.Configuration(*args, **kwargs)[source]¶
Bases:
dictDictionary-like container for the global constants.
The container has context manager support.
Initialisation is as for a
dict, and nearly all of thedictmethods are available with the same behaviours (clear,fromkeys,get,items,keys,pop,popitem,setdefault,update,values):>>> c = cfdm.Configuration(atol=0.1, rtol=0.2, log_level='INFO') >>> c <Configuration: {'atol': 0.1, 'rtol': 0.2, 'log_level': 'INFO'}> >>> print(c) {'atol': 0.1, 'rtol': 0.2, 'log_level': 'INFO'} >>> c.pop('atol') 0.1 >>> c <Configuration: {'rtol': 0.2, 'log_level': 'INFO'}> >>> c.clear() >>> c <Configuration: {}>
The
copymethod return a deep copy, rather than a shallow one.Context manager
The
Configurationinstance can be used as a context manager that upon exit executes the function defined by the_funcattribute, with the class itself as input kwargs parameters. For example, theConfigurationinstancecwould executec._func(**c)upon exit.Added in version (cfdm): 1.8.8.0
Store components.
Copying¶
Methods
Return a deep copy. |
Dictionary functionality¶
Methods
D.clear() -> None. |
|
Create a new dictionary with keys from iterable and values set to value. |
|
Return the value for key if key is in the dictionary, else default. |
|
D.items() -> a set-like object providing a view on D's items |
|
D.keys() -> a set-like object providing a view on D's keys |
|
D.pop(k[,d]) -> v, remove specified key and return the corresponding value. |
|
Remove and return a (key, value) pair as a 2-tuple. |
|
Insert key with a value of default if key is not in the dictionary. |
|
D.update([E, ]**F) -> None. |
|
D.values() -> an object providing a view on D's values |
Special¶
Methods
Enter the runtime context. |
|
Exit the runtime context. |
|
Called by the |