Metadata-Version: 2.1
Name: caom2repo
Version: 1.6
Summary: CAOM-2.4 repo access and tools
Home-page: http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/caom2
Author: Canadian Astronomy Data Centre
Author-email: cadc@nrc-cnrc.gc.ca
License: AGPLv3
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.7, <4
License-File: LICENSE
Requires-Dist: cadcutils (>=1.5.1)
Requires-Dist: caom2 (>=2.6)
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: pytest-cov (>=2.5.1) ; extra == 'test'
Requires-Dist: flake8 (>=3.4.1) ; extra == 'test'
Requires-Dist: funcsigs (==1.0.2) ; extra == 'test'
Requires-Dist: mock (>=2.0.0) ; extra == 'test'
Requires-Dist: xml-compare (>=1.0.5) ; extra == 'test'

=========
Caom2Repo
=========

.. image:: https://img.shields.io/pypi/v/caom2repo.svg
    :target: https://pypi.python.org/pypi/caom2repo

Client caom2-repo
=================
caom2Repo provides a client (caom2-repo) to perform CRUD (Create, Read, Update, Delete) on an observation in a collection in a repository.

Visitor Plugin
==============
The client also provides a visitor function which accepts a plugin. The visitor function iterates the observations of a collection and updates them according to the algorithm of the plugin function. The following is an example plugin to add a 'PREVIEW' Plane to an observation. More plugin examples can be found in caom2repo/tests/. ::

    from __future__ import (absolute_import, division, print_function,
                            unicode_literals)

    from caom2.observation import Observation
    from caom2.plane import Plane


    class ObservationUpdater(object):
        """ObservationUpdater that adds a plane to the observation."""

        def update(self, observation, **kwargs):
            """
            Processes an observation and updates it
            """
            assert isinstance(observation, Observation), (
                "observation %s is not an Observation".format(observation))
            observation.planes.add(Plane('PREVIEW'))
