parse the "uservariables" block
(self, dic, current)
| 664 | return dvariables |
| 665 | |
| 666 | def _parse_blk_uservariables(self, dic, current): |
| 667 | """parse the "uservariables" block""" |
| 668 | uvariables = self._get_entry(dic, |
| 669 | self.key_uvariables, |
| 670 | mandatory=False) |
| 671 | |
| 672 | uvars = {} |
| 673 | if not self._reloading and uvariables: |
| 674 | try: |
| 675 | for name, prompt in uvariables.items(): |
| 676 | if name in current: |
| 677 | # ignore if already defined |
| 678 | if self._debug: |
| 679 | self._dbg(f'ignore uservariables {name}') |
| 680 | continue |
| 681 | content = userinput(prompt, debug=self._debug) |
| 682 | uvars[name] = content |
| 683 | except KeyboardInterrupt as exc: |
| 684 | raise YamlException('interrupted') from exc |
| 685 | |
| 686 | if uvars: |
| 687 | uvars = uvars.copy() |
| 688 | if self._debug: |
| 689 | self._debug_dict('uservariables block', uvars) |
| 690 | |
| 691 | # save uservariables |
| 692 | if uvars: |
| 693 | try: |
| 694 | self._save_uservariables(uvars) |
| 695 | except YamlException: |
| 696 | # ignore |
| 697 | pass |
| 698 | |
| 699 | return uvars |
| 700 | |
| 701 | ######################################################## |
| 702 | # parsing helpers |
no test coverage detected