MCPcopy Create free account
hub / github.com/apache/trafficserver / add_object

Function add_object

tools/records/convert2yaml.py:200–219  ·  view source on GitHub ↗
(config, var, value, type, track_info)

Source from the content-addressed store, hash-verified

198
199
200def add_object(config, var, value, type, track_info):
201 key = ''
202 index = var.find('.')
203 if index < 0: # last part
204 if isinstance(config, dict) == False:
205 line, rec = track_info
206 raise Exception(
207 f"We cannot continue with '{rec}' at line '{line}' as a value node will be overridden.\nPlease check your config.")
208 elif var in config and isinstance(config[var], dict):
209 line, rec = track_info
210 raise Exception(
211 f"We cannot continue with '{rec}' at line '{line}' as an existing YAML map will be overridden.\nPlease check your config."
212 )
213 config[var] = get_value(type, value)
214 else:
215 key = var[:index]
216 if key not in config:
217 config[key] = {}
218
219 add_object(config[key], var[index + 1:], value, type, track_info)
220
221
222def make_tmp_file_with_renamed_fields(file):

Callers 5

handle_file_inputFunction · 0.85
add_objectMethod · 0.85
__generate_codeMethod · 0.85
add_objectMethod · 0.85
__generate_codeMethod · 0.85

Calls 3

get_valueFunction · 0.85
ExceptionClass · 0.50
findMethod · 0.45

Tested by

no test coverage detected