Coverage for python/lsst/analysis/tools/contexts/__init__.py: 100%
3 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-03-22 11:46 +0000
« prev ^ index » next coverage.py v7.4.4, created at 2024-03-22 11:46 +0000
1# This file is part of analysis_tools.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (https://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <https://www.gnu.org/licenses/>.
21r"""The context module provides the tooling to define various execution
22contexts.
24Execution contexts are defined by creating a subclass of `Context`. By
25Convention the name of the subclass should be <Name>Context.
27Multiple contexts can be joined together to create an extended Context by
28or-ing them together i.e.
30compoundContext = VisitContext | PlotContext
32A `Context` is applied to an `AnalysisAction` by calling ``applyContext`` and
33passing in a context. The `AnalysisAction` will then see if it has
34corresponding method (the name of the context with the first letter lower case
35i.e. visitContext). If a method is present, it will be called to activate the
36context for that `AnalysisAction`. The action will then recursively walk down
37through any subsequent actions calling ``applyContext``.
39When the context being applied is some compound context, a call to
40``applyContext`` will happen for each `Context` individually. The variable name
41of the compound `Context` is not important, and in some cases is unneeded i.e.
43analysis.applyContext(VisitContext | PlotContext)
45This is equivalent to:
47analysis.applyContext(VisitContext)
48analysis.applyContext(PlotContext)
50But the ability to store multiple `Context`\ s in a variable can be useful when
51linking multiple `AnalysisTool`\ s together, or creating a context that might
52be frequently reused.
54An `AnalysisAction` is entirely in control to what it does when it enters a
55`Context` or if it even responds at all based on if it implements the context
56method, and what it does inside that method.
57"""
59from ._baseContext import *
60from ._contexts import *