:py:mod:`hazimp.config_build` ============================= .. py:module:: hazimp.config_build .. autoapi-nested-parse:: Functions to assist in converting a yaml configuration file to jobs and calcs. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: hazimp.config_build.find_attributes hazimp.config_build.add_job hazimp.config_build.get_job_or_calcs hazimp.config_build._get_job_or_calc hazimp.config_build.check_1st_level_keys hazimp.config_build.validate_job_instance hazimp.config_build.file_can_open hazimp.config_build.check_files_to_load hazimp.config_build.check_attributes Attributes ~~~~~~~~~~ .. autoapisummary:: hazimp.config_build.LOGGER hazimp.config_build.CONFIGKEYS hazimp.config_build.SPELLCHECK .. py:data:: LOGGER .. py:data:: CONFIGKEYS .. py:data:: SPELLCHECK .. py:function:: find_attributes(config: dict, keys: Union[str, list]) -> Union[str, dict] Find attributes from config by the preferred key, keys must be provided in order of preference. :param config: configuration :param keys: configuration element to locate .. py:function:: add_job(jobs, new_job, atts=None) Given a list of jobs, add a new job and it's att's to the job. :param jobs: A list of jobs. :param new_job: The new job, as a string. :param atts: The attributes of the new job. .. py:function:: get_job_or_calcs(job_names) Given a list of job or calc names, return a list of job or calc instances. :param job_names: a list of job or calc names. :returns: A list of Job or Calc instances. .. py:function:: _get_job_or_calc(name) Given a job or calc name, return the job or calc instance. :param name: The name if a job or calc. :returns: A list of Job or Calc instance. .. py:function:: check_1st_level_keys(bad_name) Give an informative error if a calc name is wrong. :param bad_name: A job name that can not be resolved. :raises: RuntimeError .. py:function:: validate_job_instance(job_inst, atts) Check the job instance for various errors. :param job_inst: A reference to the job function. :param atts: The function attributes from config. .. py:function:: file_can_open(file2load) Check if a file can be opened. :param file2load: file. :returns: True if file2load can be opened. .. py:function:: check_files_to_load(atts) Check the context, based on config attributes. This function relies on some assumptions. All jobs/calcs that load files label the files as:: * file_name OR * file_list - for a list of files or a file :param atts: The function attributes from config. :raises: True for testing or RuntimeError .. py:function:: check_attributes(job_calc_function, config_args) Check the attributes of the jobs/cal functions for spelling. It will check if all attributes are:: * Missing when they are mandatory * typo args :param job_calc_function: A reference to the job function. :param config_args: The function attributes from config :raises: RuntimeError