curryer.kernels.writer ====================== .. py:module:: curryer.kernels.writer .. autoapi-nested-parse:: Kernel writer functions. @author: Brandon Stone Attributes ---------- .. autoapisummary:: curryer.kernels.writer.logger curryer.kernels.writer.TEMPLATE_NAMES curryer.kernels.writer.env Functions --------- .. autoapisummary:: curryer.kernels.writer.write_setup curryer.kernels.writer.validate_text_kernel Module Contents --------------- .. py:data:: logger .. py:data:: TEMPLATE_NAMES .. py:data:: env .. py:function:: write_setup(setup_file, template, configs, mappings=None, overwrite=False, validate=True, parent_dir=None) Write the kernel setup file. :param setup_file: File or object to write. If None, return the raw text. :type setup_file: str or file object or None :param template: Path to a template file for creating the setup_file, or a SPICE kernel type. If a SPICE kernel type, the default template will be used. :type template: str :param configs: Values to write to the setup file. Item "spice_body": Dict-like structure with "name" (str) and "code" (str or int) items. Used to define the "body" in SPICE. :type configs: dict or dict-like :param mappings: Dict-like structure with "name" (str or list of str) and "code" (int or list of int) items. Used to define the "body" in SPICE ID system. :type mappings: dict, optional :param overwrite: Option to allow overwriting existing files. :type overwrite: bool, optional :param validate: Validate that the created text follows the kernel file requirements. Default=True. Validation failure will result in a `ValueError`. :type validate: bool, optional :param parent_dir: Parent directory to use for non-absolute paths. Default is to use the current working directory. :type parent_dir: str or Path, optional :returns: Raw setup text if setup_file is None. :rtype: None or str .. py:function:: validate_text_kernel(kernel, issues=None) Validate major formatting elements of a text kernel. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/req/kernel.html :param kernel: Kernel filename or readable object to validate. :type kernel: str or obj with read attr :param issues: List to append the discovered issues to. Each issue is a tuple string pairs of the reason and the source line. :type issues: list, optional :returns: True if validation passed, otherwise False. See warnings for reasons. :rtype: bool