python.python-experimental.model_templates.method_init_composed.mustache Maven / Gradle / Ivy
required_properties = set([
'_data_store',
'_check_type',
'_from_server',
'_path_to_item',
'_configuration',
'_composed_instances',
'_var_name_to_model_instances',
'_additional_properties_model_instances',
])
{{> python-experimental/model_templates/method_init_shared }}
constant_args = {
'_check_type': _check_type,
'_path_to_item': _path_to_item,
'_from_server': _from_server,
'_configuration': _configuration,
}
required_args = {
{{#requiredVars}}
'{{name}}': {{name}},
{{/requiredVars}}
}
# remove args whose value is Null because they are unset
required_arg_names = list(required_args.keys())
for required_arg_name in required_arg_names:
if required_args[required_arg_name] is nulltype.Null:
del required_args[required_arg_name]
model_args = {}
model_args.update(required_args)
model_args.update(kwargs)
composed_info = validate_get_composed_info(
constant_args, model_args, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
unused_args = composed_info[3]
for var_name, var_value in required_args.items():
setattr(self, var_name, var_value)
for var_name, var_value in six.iteritems(kwargs):
if var_name in unused_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
not self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
© 2015 - 2024 Weber Informatics LLC | Privacy Policy