[fix] Bad conflict resolution

This commit is contained in:
ljf 2021-10-13 19:33:41 +02:00
parent 9f7fb61b50
commit ca62c01d69

View file

@ -758,16 +758,12 @@ class Question(object):
self.value = self.values[self.name] = self._post_parse_value() self.value = self.values[self.name] = self._post_parse_value()
<<<<<<< HEAD
return self.value
=======
# Search for post actions in hooks # Search for post actions in hooks
post_hook = f"post_ask__{self.name}" post_hook = f"post_ask__{self.name}"
if post_hook in self.hooks: if post_hook in self.hooks:
self.values.update(self.hooks[post_hook](self)) self.values.update(self.hooks[post_hook](self))
return self.values return self.values
>>>>>>> c0cd8dbf... [enh] config panel python method hook
def _prevalidate(self): def _prevalidate(self):
if self.value in [None, ""] and not self.optional: if self.value in [None, ""] and not self.optional:
@ -1289,14 +1285,10 @@ ARGUMENTS_TYPE_PARSERS = {
def ask_questions_and_parse_answers( def ask_questions_and_parse_answers(
<<<<<<< HEAD
raw_questions: Dict, prefilled_answers: Union[str, Mapping[str, Any]] = {}
=======
raw_questions: Dict, raw_questions: Dict,
prefilled_answers: Union[str, Mapping[str, Any]] = {}, prefilled_answers: Union[str, Mapping[str, Any]] = {},
current_values: Union[str, Mapping[str, Any]] = {}, current_values: Union[str, Mapping[str, Any]] = {},
hooks: Dict[str, Callable[[], None]] = {} hooks: Dict[str, Callable[[], None]] = {}
>>>>>>> c0cd8dbf... [enh] config panel python method hook
) -> List[Question]: ) -> List[Question]:
"""Parse arguments store in either manifest.json or actions.json or from a """Parse arguments store in either manifest.json or actions.json or from a
config panel against the user answers when they are present. config panel against the user answers when they are present.
@ -1323,24 +1315,16 @@ def ask_questions_and_parse_answers(
else: else:
answers = {} answers = {}
<<<<<<< HEAD
=======
context = {**current_values, **answers} context = {**current_values, **answers}
>>>>>>> c0cd8dbf... [enh] config panel python method hook
out = [] out = []
for raw_question in raw_questions: for raw_question in raw_questions:
question_class = ARGUMENTS_TYPE_PARSERS[raw_question.get("type", "string")] question_class = ARGUMENTS_TYPE_PARSERS[raw_question.get("type", "string")]
raw_question["value"] = answers.get(raw_question["name"]) raw_question["value"] = answers.get(raw_question["name"])
<<<<<<< HEAD
question = question_class(raw_question, context=answers)
answers[question.name] = question.ask_if_needed()
=======
question = question_class(raw_question, context=context, hooks=hooks) question = question_class(raw_question, context=context, hooks=hooks)
new_values = question.ask_if_needed() new_values = question.ask_if_needed()
answers.update(new_values) answers.update(new_values)
context.update(new_values) context.update(new_values)
>>>>>>> c0cd8dbf... [enh] config panel python method hook
out.append(question) out.append(question)
return out return out