Пример #1
0
 def giveAllRemainingFields(self):
     try:
         sure_style = styles.get_sure()
         all_remaining_fields = self.state.get_fields_list(remaining=True)
         if len(all_remaining_fields) == 0:
             ans = 'There is no field remaining'
         elif len(all_remaining_fields) == 1:
             ans = f'There is one field remaining and it is {all_remaining_fields[0]}'
         else:
             string_fields = fn.get_string_from_list(all_remaining_fields)
             ans = f"{sure_style} the remaining fields present in this form are the following: {string_fields}."
         string = self.state.manage_next_step()
         string = f'{ans}\n{string}'
         return string
     except:
         if not self.state.get_warning_present():
             print(
                 "A problem occured while a registration form bot tries to give all the remaining labels"
             )
         raise Exception
Пример #2
0
 def repeatOptionalFields(self):
     try:
         sure_style = styles.get_sure()
         optional_list = []
         slots = self.state.form_slots()
         for slot in slots:
             if slot[u.slot_name] != u.REQUESTED_SLOT:
                 if not slot[u.required]:
                     optional_list.append(slot[u.slot_name])
         optional_fields = fn.get_string_from_list(optional_list)
         ans = f"{sure_style} the optional fields are the following {optional_fields}."
         string = self.state.manage_next_step()
         string = f"{ans}\n{string}"
         return string
     except:
         if not self.state.get_warning_present():
             print(
                 "A problem occured while a registration form bot tries to repeat optional labels"
             )
         raise Exception
Пример #3
0
 def repeatRequiredFields(self):
     try:
         sure_style = styles.get_sure()
         required_fields = self.state.get_fields_list(only_required=True)
         if len(required_fields) == 0:
             ans = 'There is no required field in this form'
         elif len(required_fields) == 1:
             ans = f'There is one required field in this form which is {required_fields[0]}'
         else:
             string_fields = fn.get_string_from_list(required_fields)
             ans = f"{sure_style} the required fields are the following: {string_fields}."
         string = self.state.manage_next_step()
         string = f"{ans}\n{string}"
         return string
     except:
         if not self.state.get_warning_present():
             print(
                 "A problem occured while a registration form bot tries to repeat Required labels"
             )
         raise Exception
Пример #4
0
 def giveRemainingOptionalFields(self):
     try:
         sure_style = styles.get_sure()
         remaining_optional_list = []
         slots = self.state.form_slots()
         for slot in slots:
             if slot[u.slot_name] != u.REQUESTED_SLOT:
                 if not slot[u.required]:
                     if slot[u.slot_value] is None:
                         # we add remaining optional fields
                         remaining_optional_list.append(slot[u.slot_name])
         optional_fields = fn.get_string_from_list(remaining_optional_list)
         ans = f"{sure_style} the remaining optional fields are the following {optional_fields}."
         next_step_string = self.state.manage_next_step()
         string = f'{ans}\n{next_step_string}'
         return string
     except:
         if not self.state.get_warning_present():
             print(
                 "A problem occured while a registration form bot tries to give the remaining optional labels"
             )
         raise Exception
Пример #5
0
 def repeatFormExplanation(self):
     try:
         form_desc = self.state.get_form_description()
         next_step_string = self.state.manage_next_step()
         if form_desc is None:
             sorry_style = styles.get_sorry()
             string = f"{sorry_style} this form does not have a description.\n{next_step_string}"
             _, required = self.state.get_next_slot()
             if not required:
                 string = f'{string} otherwise, you can {u.fun_skip}'
             else:
                 string = f'{string} otherwise, you can {u.fun_recap} or {u.fun_verify_value}. In any case you will have to complete this field in order to submit'
         else:
             sure_style = styles.get_sure()
             string = f"{sure_style} here it is: {form_desc}."
             string = f'{string}\n{next_step_string}'
         return string
     except:
         if not self.state.get_warning_present():
             print(
                 "A problem occured while a registration form bot tries to repeat the form's explanation"
             )
         raise Exception