in packages/autorest.python/autorest/m4reformatter/__init__.py [0:0]
def update_type(yaml_data: Dict[str, Any]) -> Dict[str, Any]:
if id(yaml_data) in ORIGINAL_ID_TO_UPDATED_TYPE:
return ORIGINAL_ID_TO_UPDATED_TYPE[id(yaml_data)]
type_group = yaml_data["type"]
if type_group == "array":
updated_type = update_list(yaml_data)
elif type_group == "dictionary":
updated_type = update_dict(yaml_data)
elif type_group == "constant":
updated_type = update_constant(yaml_data)
elif type_group in ("choice", "sealed-choice"):
updated_type = update_enum(yaml_data)
elif type_group in (OAUTH_TYPE, KEY_TYPE):
updated_type = yaml_data
elif type_group in ("object", "group"):
# avoiding infinite loop
initial_model = create_model(yaml_data)
ORIGINAL_ID_TO_UPDATED_TYPE[id(yaml_data)] = initial_model
updated_type = fill_model(yaml_data, initial_model)
else:
updated_type = update_primitive(type_group, yaml_data)
ORIGINAL_ID_TO_UPDATED_TYPE[id(yaml_data)] = updated_type
return updated_type