MCPcopy
hub / github.com/deadc0de6/dotdrop / _parse_blk_uservariables

Method _parse_blk_uservariables

dotdrop/cfg_yaml.py:666–699  ·  view source on GitHub ↗

parse the "uservariables" block

(self, dic, current)

Source from the content-addressed store, hash-verified

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

Callers 1

__init__Method · 0.95

Calls 7

_get_entryMethod · 0.95
_dbgMethod · 0.95
_debug_dictMethod · 0.95
_save_uservariablesMethod · 0.95
userinputFunction · 0.90
YamlExceptionClass · 0.90
copyMethod · 0.45

Tested by

no test coverage detected