MCPcopy
hub / github.com/cherrypy/cherrypy / merge

Function merge

cherrypy/_cpconfig.py:131–147  ·  view source on GitHub ↗

Merge one app config (from a dict, file, or filename) into another. If the given config is a filename, it will be appended to the list of files to monitor for "autoreload" changes.

(base, other)

Source from the content-addressed store, hash-verified

129
130
131def merge(base, other):
132 """Merge one app config (from a dict, file, or filename) into another.
133
134 If the given config is a filename, it will be appended to the list
135 of files to monitor for "autoreload" changes.
136 """
137 _if_filename_register_autoreload(other)
138
139 # Load other into base
140 for section, value_map in reprconf.Parser.load(other).items():
141 if not isinstance(value_map, dict):
142 raise ValueError(
143 'Application config must include section headers, but the '
144 "config you tried to merge doesn't have any sections. "
145 'Wrap your config in another dict with paths as section '
146 "headers, for example: {'/': config}.")
147 base.setdefault(section, {}).update(value_map)
148
149
150class Config(reprconf.Config):

Callers 1

find_handlerMethod · 0.85

Calls 5

itemsMethod · 0.80
loadMethod · 0.45
updateMethod · 0.45
setdefaultMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…