:mod:`memote.suite.results` =========================== .. py:module:: memote.suite.results .. autoapi-nested-parse:: Provide the memote result object and managers for various situations. * The ``MemoteResult`` represents the collective result of running the metabolic model test suite on a given model at a certain point in time. * The ``ResultManager`` and its subclasses knows how to store a `MemoteResult` in various data backends (file, SQL, NoSQL). * The ``ResultHistoryManager`` uses the different ``ResultManager``\ s to iterate over and collect a model's test result history. .. !! processed by numpydoc !! Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 history_manager/index.rst models/index.rst repo_result_manager/index.rst result/index.rst result_manager/index.rst sql_result_manager/index.rst Package Contents ---------------- Classes ~~~~~~~ .. autoapisummary:: memote.suite.results.MemoteResult memote.suite.results.ResultManager memote.suite.results.RepoResultManager memote.suite.results.SQLResultManager memote.suite.results.HistoryManager .. py:class:: MemoteResult(*args, **kwargs) Bases: :class:`dict` Collect the metabolic model test suite results. .. !! processed by numpydoc !! .. staticmethod:: add_environment_information(meta) Record environment information. .. !! processed by numpydoc !! .. py:class:: ResultManager(**kwargs) Bases: :class:`object` Manage storage of results to JSON files. .. !! processed by numpydoc !! .. method:: store(self, result, filename, pretty=True) Write a result to the given file. :Parameters: **result** : memote.MemoteResult The dictionary structure of results. **filename** : str or pathlib.Path Store results directly to the given filename. **pretty** : bool, optional Whether (default) or not to write JSON in a more legible format. .. !! processed by numpydoc !! .. method:: load(self, filename) Load a result from the given JSON file. .. !! processed by numpydoc !! .. py:class:: RepoResultManager(repository, location, **kwargs) Bases: :class:`memote.suite.results.result_manager.ResultManager` Manage storage of results to JSON files. Results are stored to and loaded from a specific location (directory) and enriched with git commit meta information. .. !! processed by numpydoc !! .. method:: record_git_info(self, commit=None) Record git meta information. :Parameters: **commit** : str, optional Unique hexsha of the desired commit. :Returns: GitInfo Git commit meta information. .. !! processed by numpydoc !! .. method:: get_filename(self, git_info) Create a filename from the storage directory and the commit hash. :Parameters: **git_info** : GitInfo A named tuple with git meta information. :Returns: str The path to the file where the result of the current commit is stored. .. !! processed by numpydoc !! .. staticmethod:: add_git(meta, git_info) Enrich the result meta information with commit data. .. !! processed by numpydoc !! .. method:: store(self, result, commit=None, **kwargs) Store a result in a JSON file attaching git meta information. :Parameters: **result** : memote.MemoteResult The dictionary structure of results. **commit** : str, optional Unique hexsha of the desired commit. **kwargs** Passed to parent function. .. !! processed by numpydoc !! .. method:: load(self, commit=None) Load a result from the storage directory. .. !! processed by numpydoc !! .. py:class:: SQLResultManager(**kwargs) Bases: :class:`memote.suite.results.repo_result_manager.RepoResultManager` Manage storage of results to a database. .. !! processed by numpydoc !! .. method:: store(self, result, commit=None, **kwargs) Store a result in a JSON file attaching git meta information. :Parameters: **result** : memote.MemoteResult The dictionary structure of results. **commit** : str, optional Unique hexsha of the desired commit. **kwargs** Passed to parent function. .. !! processed by numpydoc !! .. method:: load(self, commit=None) Load a result from the database. .. !! processed by numpydoc !! .. py:class:: HistoryManager(repository, manager, **kwargs) Bases: :class:`object` Manage access to results in the commit history of a git repository. :Attributes: **manager** : memote.RepoResultManager The manager for accessing individual results. **current** : str The name of the currently active branch. .. !! processed by numpydoc !! .. method:: build_branch_structure(self, model, skip) Inspect and record the repo's branches and their history. .. !! processed by numpydoc !! .. method:: iter_branches(self) Iterate over branch names and their commit histories. .. !! processed by numpydoc !! .. method:: iter_commits(self) Iterate over all commit hashes in the repository. .. !! processed by numpydoc !! .. method:: load_history(self, model, skip=('gh-pages', )) Load the entire results history into memory. Could be a bad idea in a far future. .. !! processed by numpydoc !! .. method:: get_result(self, commit, default=None) Return an individual result from the history if it exists. .. !! processed by numpydoc !! .. method:: __contains__(self, commit) Test for the existence of a result for a commit. .. !! processed by numpydoc !!