MCPcopy Index your code
hub / github.com/archlinux/archinstall / _write_plugin_to_temp_file

Method _write_plugin_to_temp_file

archinstall/lib/args.py:765–784  ·  view source on GitHub ↗
(self, plugin_data: str)

Source from the content-addressed store, hash-verified

763 sys.exit(1)
764
765 def _write_plugin_to_temp_file(self, plugin_data: str) -> Path:
766 if not plugin_data.strip():
767 error('The downloaded plugin is empty')
768 sys.exit(1)
769
770 tmp_file = tempfile.NamedTemporaryFile(
771 mode='w',
772 suffix='.py',
773 prefix='archinstall_plugin_',
774 delete=False,
775 )
776
777 try:
778 with tmp_file as f:
779 f.write(plugin_data)
780 except OSError as err:
781 error(f'Could not write the downloaded plugin to a temporary file: {err}')
782 sys.exit(1)
783
784 return Path(tmp_file.name)
785
786 def _read_file(self, path: Path) -> str:
787 if not path.exists():

Callers 1

_parse_argsMethod · 0.95

Calls 3

errorFunction · 0.90
exitMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected