Load a specific wizard. Given a command and wizard name (i.e something from the output of ``list_available_wizards``), return the loaded file. This will open the file and return the parsed yaml contents of the file.
(self, command_name, wizard_name)
| 74 | return [os.path.splitext(f)[0] for f in files] |
| 75 | |
| 76 | def load_wizard(self, command_name, wizard_name): |
| 77 | """Load a specific wizard. |
| 78 | |
| 79 | Given a command and wizard name (i.e something from the |
| 80 | output of ``list_available_wizards``), return the loaded file. |
| 81 | This will open the file and return the parsed yaml contents |
| 82 | of the file. |
| 83 | |
| 84 | """ |
| 85 | filename = os.path.join( |
| 86 | self._spec_dir, command_name, wizard_name + '.yml' |
| 87 | ) |
| 88 | try: |
| 89 | with open(filename) as f: |
| 90 | return self._load_yaml(f.read()) |
| 91 | except OSError: |
| 92 | raise WizardNotExistError( |
| 93 | "Wizard does not exist for command " |
| 94 | "'%s', name: '%s'" % (command_name, wizard_name) |
| 95 | ) |
| 96 | |
| 97 | def _load_yaml(self, contents): |
| 98 | data = self._yaml.load(contents) |