feat: remove return_values_not_error and only_default parameter
This commit is contained in:
parent
5759e4f86b
commit
92b5257e66
1 changed files with 5 additions and 14 deletions
|
|
@ -49,15 +49,12 @@ class UserDatas:
|
||||||
self,
|
self,
|
||||||
user_datas: List[dict],
|
user_datas: List[dict],
|
||||||
*,
|
*,
|
||||||
return_values_not_error=False,
|
|
||||||
user_datas_type: str = "user_datas",
|
user_datas_type: str = "user_datas",
|
||||||
only_default: bool = False,
|
|
||||||
):
|
):
|
||||||
self.values = {}
|
self.values = {}
|
||||||
self.errors = []
|
self.errors = []
|
||||||
self.warnings = []
|
self.warnings = []
|
||||||
self.show_secrets = False
|
self.show_secrets = False
|
||||||
self.only_default = only_default
|
|
||||||
if user_datas_type == "user_datas":
|
if user_datas_type == "user_datas":
|
||||||
self._populate_values(user_datas)
|
self._populate_values(user_datas)
|
||||||
else:
|
else:
|
||||||
|
|
@ -65,14 +62,11 @@ class UserDatas:
|
||||||
self._auto_configure_dynamics()
|
self._auto_configure_dynamics()
|
||||||
self._populate_config()
|
self._populate_config()
|
||||||
self.properties_to_string = get_properties_to_string()
|
self.properties_to_string = get_properties_to_string()
|
||||||
if return_values_not_error:
|
self._populate_error_warnings()
|
||||||
return self.values
|
return {
|
||||||
else:
|
"errors": self.errors,
|
||||||
self._populate_error_warnings()
|
"warnings": self.warnings,
|
||||||
return {
|
}
|
||||||
"errors": self.errors,
|
|
||||||
"warnings": self.warnings,
|
|
||||||
}
|
|
||||||
|
|
||||||
def _populate_values(self, user_datas):
|
def _populate_values(self, user_datas):
|
||||||
for datas in user_datas:
|
for datas in user_datas:
|
||||||
|
|
@ -215,9 +209,6 @@ class UserDatas:
|
||||||
values_path = option.path(uncalculated=True)
|
values_path = option.path(uncalculated=True)
|
||||||
if values_path not in self.values:
|
if values_path not in self.values:
|
||||||
continue
|
continue
|
||||||
if self.only_default and option.owner.get() != owners.default:
|
|
||||||
self.values.pop(values_path)
|
|
||||||
continue
|
|
||||||
options = self.values[values_path].get("options", {})
|
options = self.values[values_path].get("options", {})
|
||||||
if (
|
if (
|
||||||
options.get("allow_secrets_variables", True) is False
|
options.get("allow_secrets_variables", True) is False
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue