atlas-schema 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ """
2
+ Copyright (c) 2024 Giordon Stark. All rights reserved.
3
+
4
+ atlas_schema: Collection of utilities and helper functions for HEP ATLAS analysers
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from atlas_schema._version import version as __version__
10
+ from atlas_schema.enums import ParticleOrigin, PhotonID
11
+
12
+ __all__ = ["__version__", "ParticleOrigin", "PhotonID"]
@@ -0,0 +1,16 @@
1
+ # file generated by setuptools_scm
2
+ # don't change, don't track in version control
3
+ TYPE_CHECKING = False
4
+ if TYPE_CHECKING:
5
+ from typing import Tuple, Union
6
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
7
+ else:
8
+ VERSION_TUPLE = object
9
+
10
+ version: str
11
+ __version__: str
12
+ __version_tuple__: VERSION_TUPLE
13
+ version_tuple: VERSION_TUPLE
14
+
15
+ __version__ = version = '0.1.0'
16
+ __version_tuple__ = version_tuple = (0, 1, 0)
@@ -0,0 +1,4 @@
1
+ from __future__ import annotations
2
+
3
+ version: str
4
+ version_tuple: tuple[int, int, int] | tuple[int, int, int, str, str]
atlas_schema/enums.py ADDED
@@ -0,0 +1,116 @@
1
+ from __future__ import annotations
2
+
3
+ from enum import IntEnum
4
+
5
+ from atlas_schema.typing_compat import Annotated
6
+
7
+
8
+ # https://gitlab.cern.ch/atlas/athena/-/blob/74f43ff0910edb2a2bd3778880ccbdad648dc037/Generators/TruthUtils/TruthUtils/TruthClasses.h#L51-103
9
+ class ParticleType(IntEnum):
10
+ Unknown: Annotated[int, "Unknown"] = 0
11
+ UnknownElectron: Annotated[int, "UnknownElectron"] = 1
12
+ IsoElectron: Annotated[int, "IsoElectron"] = 2
13
+ NonIsoElectron: Annotated[int, "NonIsoElectron"] = 3
14
+ BkgElectron: Annotated[int, "BkgElectron"] = 4
15
+ UnknownMuon: Annotated[int, "UnknownMuon"] = 5
16
+ IsoMuon: Annotated[int, "IsoMuon"] = 6
17
+ NonIsoMuon: Annotated[int, "NonIsoMuon"] = 7
18
+ BkgMuon: Annotated[int, "BkgMuon"] = 8
19
+ UnknownTau: Annotated[int, "UnknownTau"] = 9
20
+ IsoTau: Annotated[int, "IsoTau"] = 10
21
+ NonIsoTau: Annotated[int, "NonIsoTau"] = 11
22
+ BkgTau: Annotated[int, "BkgTau"] = 12
23
+ UnknownPhoton: Annotated[int, "UnknownPhoton"] = 13
24
+ IsoPhoton: Annotated[int, "IsoPhoton"] = 14
25
+ NonIsoPhoton: Annotated[int, "NonIsoPhoton"] = 15
26
+ BkgPhoton: Annotated[int, "BkgPhoton"] = 16
27
+ Hadron: Annotated[int, "Hadron"] = 17
28
+ Neutrino: Annotated[int, "Neutrino"] = 18
29
+ NuclFrag: Annotated[int, "NuclFrag"] = 19
30
+ NonPrimary: Annotated[int, "NonPrimary"] = 20
31
+ GenParticle: Annotated[int, "GenParticle"] = 21
32
+ SUSYParticle: Annotated[int, "SUSYParticle"] = 22
33
+ OtherBSMParticle: Annotated[int, "OtherBSMParticle"] = 39
34
+ BBbarMesonPart: Annotated[int, "BBbarMesonPart"] = 23
35
+ BottomMesonPart: Annotated[int, "BottomMesonPart"] = 24
36
+ CCbarMesonPart: Annotated[int, "CCbarMesonPart"] = 25
37
+ CharmedMesonPart: Annotated[int, "CharmedMesonPart"] = 26
38
+ BottomBaryonPart: Annotated[int, "BottomBaryonPart"] = 27
39
+ CharmedBaryonPart: Annotated[int, "CharmedBaryonPart"] = 28
40
+ StrangeBaryonPart: Annotated[int, "StrangeBaryonPart"] = 29
41
+ LightBaryonPart: Annotated[int, "LightBaryonPart"] = 30
42
+ StrangeMesonPart: Annotated[int, "StrangeMesonPart"] = 31
43
+ LightMesonPart: Annotated[int, "LightMesonPart"] = 32
44
+ BJet: Annotated[int, "BJet"] = 33
45
+ CJet: Annotated[int, "CJet"] = 34
46
+ LJet: Annotated[int, "LJet"] = 35
47
+ GJet: Annotated[int, "GJet"] = 36
48
+ TauJet: Annotated[int, "TauJet"] = 37
49
+ UnknownJet: Annotated[int, "UnknownJet"] = 38
50
+
51
+
52
+ # https://gitlab.cern.ch/atlas/athena/-/blob/74f43ff0910edb2a2bd3778880ccbdad648dc037/Generators/TruthUtils/TruthUtils/TruthClasses.h#L51-103
53
+ class ParticleOrigin(IntEnum):
54
+ NonDefined: Annotated[int, "NonDefined"] = 0
55
+ SingleElec: Annotated[int, "SingleElec"] = 1
56
+ SingleMuon: Annotated[int, "SingleMuon"] = 2
57
+ SinglePhot: Annotated[int, "SinglePhot"] = 3
58
+ SingleTau: Annotated[int, "SingleTau"] = 4
59
+ PhotonConv: Annotated[int, "PhotonConv"] = 5
60
+ DalitzDec: Annotated[int, "DalitzDec"] = 6
61
+ ElMagProc: Annotated[int, "ElMagProc"] = 7
62
+ Mu: Annotated[int, "Mu"] = 8
63
+ TauLep: Annotated[int, "TauLep"] = 9
64
+ top: Annotated[int, "top"] = 10
65
+ QuarkWeakDec: Annotated[int, "QuarkWeakDec"] = 11
66
+ WBoson: Annotated[int, "WBoson"] = 12
67
+ ZBoson: Annotated[int, "ZBoson"] = 13
68
+ Higgs: Annotated[int, "Higgs"] = 14
69
+ HiggsMSSM: Annotated[int, "HiggsMSSM"] = 15
70
+ HeavyBoson: Annotated[int, "HeavyBoson"] = 16
71
+ WBosonLRSM: Annotated[int, "WBosonLRSM"] = 17
72
+ NuREle: Annotated[int, "NuREle"] = 18
73
+ NuRMu: Annotated[int, "NuRMu"] = 19
74
+ NuRTau: Annotated[int, "NuRTau"] = 20
75
+ LQ: Annotated[int, "LQ"] = 21
76
+ SUSY: Annotated[int, "SUSY"] = 22
77
+ OtherBSM: Annotated[int, "OtherBSM"] = 46
78
+ LightMeson: Annotated[int, "LightMeson"] = 23
79
+ StrangeMeson: Annotated[int, "StrangeMeson"] = 24
80
+ CharmedMeson: Annotated[int, "CharmedMeson"] = 25
81
+ BottomMeson: Annotated[int, "BottomMeson"] = 26
82
+ CCbarMeson: Annotated[int, "CCbarMeson"] = 27
83
+ JPsi: Annotated[int, "JPsi"] = 28
84
+ BBbarMeson: Annotated[int, "BBbarMeson"] = 29
85
+ LightBaryon: Annotated[int, "LightBaryon"] = 30
86
+ StrangeBaryon: Annotated[int, "StrangeBaryon"] = 31
87
+ CharmedBaryon: Annotated[int, "CharmedBaryon"] = 32
88
+ BottomBaryon: Annotated[int, "BottomBaryon"] = 33
89
+ PionDecay: Annotated[int, "PionDecay"] = 34
90
+ KaonDecay: Annotated[int, "KaonDecay"] = 35
91
+ BremPhot: Annotated[int, "BremPhot"] = 36
92
+ PromptPhot: Annotated[int, "PromptPhot"] = 37
93
+ UndrPhot: Annotated[int, "UndrPhot"] = 38
94
+ ISRPhot: Annotated[int, "ISRPhot"] = 39
95
+ FSRPhot: Annotated[int, "FSRPhot"] = 40
96
+ NucReact: Annotated[int, "NucReact"] = 41
97
+ PiZero: Annotated[int, "PiZero"] = 42
98
+ DiBoson: Annotated[int, "DiBoson"] = 43
99
+ ZorHeavyBoson: Annotated[int, "ZorHeavyBoson"] = 44
100
+ MultiBoson: Annotated[int, "MultiBoson"] = 47
101
+ QCD: Annotated[int, "QCD"] = 45
102
+
103
+
104
+ # https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/EGammaIdentificationRun2#Photon_isEM_word
105
+ class PhotonID(IntEnum):
106
+ Rhad: Annotated[int, "ClusterHadronicLeakage_Photon"] = 10
107
+ E277: Annotated[int, "ClusterMiddleEnergy_Photon"] = 11
108
+ Reta: Annotated[int, "ClusterMiddleEratio37_Photon"] = 12
109
+ Rphi: Annotated[int, "ClusterMiddleEratio33_Photon"] = 13
110
+ Weta2: Annotated[int, "ClusterMiddleWidth_Photon"] = 14
111
+ f1: Annotated[int, "ClusterStripsEratio_Photon"] = 15
112
+ DeltaE: Annotated[int, "ClusterStripsDeltaE_Photon"] = 17
113
+ Wstot: Annotated[int, "ClusterStripsWtot_Photon"] = 18
114
+ fside: Annotated[int, "ClusterStripsFracm_Photon"] = 19
115
+ Ws3: Annotated[int, "ClusterStripsWeta1c_Photon"] = 20
116
+ ERatio: Annotated[int, "ClusterStripsDEmaxs1_Photon"] = 21
@@ -0,0 +1,181 @@
1
+ """Mixins for the Ntuple schema"""
2
+
3
+ from __future__ import annotations
4
+
5
+ from functools import reduce
6
+ from operator import ior
7
+
8
+ import awkward
9
+ from coffea.nanoevents.methods import base, candidate, vector
10
+ from dask_awkward import dask_method
11
+
12
+ from atlas_schema.enums import PhotonID
13
+ from atlas_schema.typing_compat import Behavior
14
+
15
+ behavior: Behavior = {}
16
+ behavior.update(base.behavior)
17
+ # vector behavior is included in candidate behavior
18
+ behavior.update(candidate.behavior)
19
+
20
+
21
+ class NtupleEvents(behavior["NanoEvents"]): # type: ignore[misc, valid-type, name-defined]
22
+ def __repr__(self):
23
+ return f"<event {getattr(self,'runNumber','??')}:\
24
+ {getattr(self,'eventNumber','??')}:\
25
+ {getattr(self,'mcChannelNumber','??')}>"
26
+
27
+
28
+ behavior["NanoEvents"] = NtupleEvents
29
+
30
+
31
+ def _set_repr_name(classname):
32
+ def namefcn(_self):
33
+ return classname
34
+
35
+ behavior[("__typestr__", classname)] = classname[0].lower() + classname[1:]
36
+ behavior[classname].__repr__ = namefcn
37
+
38
+
39
+ @awkward.mixin_class(behavior)
40
+ class Weight(base.NanoCollection, base.Systematic): ...
41
+
42
+
43
+ _set_repr_name("Weight")
44
+
45
+
46
+ @awkward.mixin_class(behavior)
47
+ class Pass(base.NanoCollection, base.Systematic): ...
48
+
49
+
50
+ _set_repr_name("Pass")
51
+
52
+
53
+ @awkward.mixin_class(behavior)
54
+ class Particle(vector.PtEtaPhiMLorentzVector):
55
+ """Generic particle collection that has Lorentz vector properties
56
+
57
+ Also handles the following additional branches:
58
+ - '{obj}_select'
59
+ """
60
+
61
+ @property
62
+ def mass(self):
63
+ r"""Invariant mass (+, -, -, -)
64
+
65
+ :math:`\sqrt{t^2-x^2-y^2-z^2}`
66
+ """
67
+ return self["mass"] / 1.0e3
68
+
69
+ @dask_method
70
+ def passes(self, name):
71
+ return self[f"select_{name}"] == 1
72
+
73
+ @passes.dask
74
+ def passes(self, dask_array, name):
75
+ return dask_array[f"select_{name}"] == 1
76
+
77
+ # NB: fields with the name 'pt' take precedence over this
78
+ # @dask_property
79
+ # def pt(self):
80
+ # print('inside non-dask prop')
81
+ # return self["pt_NOSYS"]
82
+
83
+ # @pt.dask
84
+ # def pt(self, dask_array):
85
+ # branch = 'pt'
86
+ # print('inside dask prop')
87
+ # variation = dask_array._events().metadata.get("systematic", "NOSYS")
88
+ # with contextlib.suppress(Exception):
89
+ # return dask_array[f"{branch}_{variation}"]
90
+
91
+ # if variation != "NOSYS":
92
+ # with contextlib.suppress(Exception):
93
+ # return dask_array[f"{branch}_NOSYS"]
94
+
95
+ # return dask_array[branch]
96
+
97
+
98
+ _set_repr_name("Particle")
99
+
100
+
101
+ @awkward.mixin_class(behavior)
102
+ class MasslessParticle(Particle, base.NanoCollection):
103
+ @property
104
+ def mass(self):
105
+ r"""Invariant mass (+, -, -, -)
106
+
107
+ :math:`\sqrt{t^2-x^2-y^2-z^2}`
108
+ """
109
+ return 0.0 * self.pt
110
+
111
+
112
+ _set_repr_name("MasslessParticle")
113
+
114
+
115
+ @awkward.mixin_class(behavior)
116
+ class MissingET(MasslessParticle, base.NanoCollection, base.Systematic):
117
+ @property
118
+ def pt(self):
119
+ """Alias for `r`"""
120
+ return self["met"] / 1.0e3
121
+
122
+ @property
123
+ def eta(self):
124
+ r"""Pseudorapidity
125
+
126
+ :math:`-\ln\tan(\theta/2) = \text{arcsinh}(z/r)`
127
+ """
128
+ return 0.0 * self.pt
129
+
130
+
131
+ _set_repr_name("MissingET")
132
+
133
+
134
+ @awkward.mixin_class(behavior)
135
+ class Photon(MasslessParticle, base.NanoCollection, base.Systematic):
136
+ @property
137
+ def isEM(self):
138
+ return self.isEM_syst.NOSYS == 0
139
+
140
+ def pass_isEM(self, words: list[PhotonID]):
141
+ # 0 is pass, 1 is fail
142
+ return (
143
+ self.isEM_syst.NOSYS & reduce(ior, (1 << word.value for word in words))
144
+ ) == 0
145
+
146
+
147
+ _set_repr_name("Photon")
148
+
149
+
150
+ @awkward.mixin_class(behavior)
151
+ class Electron(MasslessParticle, base.NanoCollection, base.Systematic): ...
152
+
153
+
154
+ _set_repr_name("Electron")
155
+
156
+
157
+ @awkward.mixin_class(behavior)
158
+ class Muon(MasslessParticle, base.NanoCollection, base.Systematic): ...
159
+
160
+
161
+ _set_repr_name("Muon")
162
+
163
+
164
+ @awkward.mixin_class(behavior)
165
+ class Jet(Particle, base.NanoCollection, base.Systematic): ...
166
+
167
+
168
+ _set_repr_name("Jet")
169
+
170
+
171
+ __all__ = [
172
+ "NtupleEvents",
173
+ "Weight",
174
+ "Pass",
175
+ "MissingET",
176
+ "Particle",
177
+ "Photon",
178
+ "Electron",
179
+ "Muon",
180
+ "Jet",
181
+ ]
atlas_schema/py.typed ADDED
File without changes
atlas_schema/schema.py ADDED
@@ -0,0 +1,206 @@
1
+ from __future__ import annotations
2
+
3
+ import warnings
4
+ from collections.abc import KeysView, ValuesView
5
+ from typing import Any, ClassVar
6
+
7
+ from coffea.nanoevents.schemas.base import BaseSchema, zip_forms
8
+
9
+ from atlas_schema.typing_compat import Behavior, Self
10
+
11
+
12
+ class NtupleSchema(BaseSchema): # type: ignore[misc]
13
+ """Ntuple schema builder
14
+
15
+ The Ntuple schema is built from all branches found in the supplied file, based on
16
+ the naming pattern of the branches. The following additional arrays are constructed:
17
+
18
+ - n/a
19
+ """
20
+
21
+ __dask_capable__ = True
22
+
23
+ warn_missing_crossrefs = True
24
+ error_missing_event_ids = False
25
+
26
+ event_ids_data: ClassVar[set[str]] = {
27
+ "lumiBlock",
28
+ "averageInteractionsPerCrossing",
29
+ "actualInteractionsPerCrossing",
30
+ "dataTakingYear",
31
+ }
32
+ event_ids_mc: ClassVar[set[str]] = {
33
+ "mcChannelNumber",
34
+ "runNumber",
35
+ "eventNumber",
36
+ "mcEventWeights",
37
+ }
38
+ event_ids: ClassVar[set[str]] = {*event_ids_data, *event_ids_mc}
39
+
40
+ mixins: ClassVar[dict[str, str]] = {
41
+ "el": "Electron",
42
+ "jet": "Jet",
43
+ "met": "MissingET",
44
+ "mu": "Muon",
45
+ "pass": "Pass",
46
+ "ph": "Photon",
47
+ "trigPassed": "Trigger",
48
+ "weight": "Weight",
49
+ }
50
+
51
+ # These are stored as length-1 vectors unnecessarily
52
+ singletons: ClassVar[list[str]] = []
53
+
54
+ docstrings: ClassVar[dict[str, str]] = {
55
+ "charge": "charge",
56
+ "eta": "pseudorapidity",
57
+ "met": "missing transverse energy [MeV]",
58
+ "mass": "invariant mass [MeV]",
59
+ "pt": "transverse momentum [MeV]",
60
+ "phi": "azimuthal angle",
61
+ }
62
+
63
+ def __init__(self, base_form: dict[str, Any], version: str = "latest"):
64
+ super().__init__(base_form)
65
+ self._version = version
66
+ if version == "latest":
67
+ pass
68
+ else:
69
+ pass
70
+ self._form["fields"], self._form["contents"] = self._build_collections(
71
+ self._form["fields"], self._form["contents"]
72
+ )
73
+ self._form["parameters"]["metadata"]["version"] = self._version
74
+
75
+ @classmethod
76
+ def v1(cls, base_form: dict[str, Any]) -> Self:
77
+ """Build the NtupleEvents
78
+
79
+ For example, one can use ``NanoEventsFactory.from_root("file.root", schemaclass=NtupleSchema.v1)``
80
+ to ensure NanoAODv7 compatibility.
81
+ """
82
+ return cls(base_form, version="1")
83
+
84
+ def _build_collections(
85
+ self, field_names: list[str], input_contents: list[Any]
86
+ ) -> tuple[KeysView[str], ValuesView[dict[str, Any]]]:
87
+ branch_forms = dict(zip(field_names, input_contents))
88
+
89
+ # parse into high-level records (collections, list collections, and singletons)
90
+ collections = {k.split("_")[0] for k in branch_forms}
91
+ collections -= self.event_ids
92
+ collections -= set(self.singletons)
93
+
94
+ # rename needed because easyjet breaks the AMG assumptions
95
+ # https://gitlab.cern.ch/easyjet/easyjet/-/issues/246
96
+ for k in list(branch_forms):
97
+ if "NOSYS" not in k:
98
+ continue
99
+ branch_forms[k.replace("_NOSYS", "") + "_NOSYS"] = branch_forms.pop(k)
100
+
101
+ # these are collections with systematic variations
102
+ subcollections = {
103
+ k.split("__")[0].split("_", 1)[1].replace("_NOSYS", "")
104
+ for k in branch_forms
105
+ if "NOSYS" in k
106
+ }
107
+
108
+ # Check the presence of the event_ids
109
+ missing_event_ids = [
110
+ event_id for event_id in self.event_ids if event_id not in branch_forms
111
+ ]
112
+
113
+ if len(missing_event_ids) > 0:
114
+ if self.error_missing_event_ids:
115
+ msg = f"There are missing event ID fields: {missing_event_ids} \n\n\
116
+ The event ID fields {self.event_ids} are necessary to perform sub-run identification \
117
+ (e.g. for corrections and sub-dividing data during different detector conditions),\
118
+ to cross-validate MC and Data (i.e. matching events for comparison), and to generate event displays. \
119
+ It's advised to never drop these branches from the dataformat.\n\n\
120
+ This error can be demoted to a warning by setting the class level variable error_missing_event_ids to False."
121
+ raise RuntimeError(msg)
122
+ warnings.warn(
123
+ f"Missing event_ids : {missing_event_ids}",
124
+ RuntimeWarning,
125
+ stacklevel=2,
126
+ )
127
+
128
+ output = {}
129
+
130
+ # first, register the event-level stuff directly
131
+ for name in self.event_ids:
132
+ if name in missing_event_ids:
133
+ continue
134
+ output[name] = branch_forms[name]
135
+
136
+ # next, go through and start grouping up collections
137
+ for name in collections:
138
+ mixin = self.mixins.get(name, "NanoCollection")
139
+ content = {}
140
+ used = set()
141
+
142
+ for subname in subcollections:
143
+ prefix = f"{name}_{subname}_"
144
+ used.update({k for k in branch_forms if k.startswith(prefix)})
145
+ subcontent = {
146
+ k[len(prefix) :]: branch_forms[k]
147
+ for k in branch_forms
148
+ if k.startswith(prefix)
149
+ }
150
+ if subcontent:
151
+ # create the nominal version
152
+ content[subname] = branch_forms[f"{prefix}NOSYS"]
153
+ # create a collection of the systematic variations for the given variable
154
+ content[f"{subname}_syst"] = zip_forms(
155
+ subcontent, f"{name}_syst", record_name="NanoCollection"
156
+ )
157
+
158
+ content.update(
159
+ {
160
+ k[len(name) + 1 :]: branch_forms[k]
161
+ for k in branch_forms
162
+ if k.startswith(name + "_") and k not in used
163
+ }
164
+ )
165
+
166
+ output[name] = zip_forms(content, name, record_name=mixin)
167
+
168
+ output[name].setdefault("parameters", {})
169
+ output[name]["parameters"].update({"collection_name": name})
170
+
171
+ if output[name]["class"] == "ListOffsetArray":
172
+ parameters = output[name]["content"]["fields"]
173
+ contents = output[name]["content"]["contents"]
174
+ elif output[name]["class"] == "RecordArray":
175
+ parameters = output[name]["fields"]
176
+ contents = output[name]["contents"]
177
+ else:
178
+ msg = f"Unhandled class {output[name]['class']}"
179
+ raise RuntimeError(msg)
180
+ # update docstrings as needed
181
+ # NB: must be before flattening for easier logic
182
+ for index, parameter in enumerate(parameters):
183
+ if "parameters" not in contents[index]:
184
+ continue
185
+
186
+ parsed_name = parameter.replace("_NOSYS", "")
187
+ contents[index]["parameters"]["__doc__"] = self.docstrings.get(
188
+ parsed_name,
189
+ contents[index]["parameters"].get(
190
+ "__doc__", "no docstring available"
191
+ ),
192
+ )
193
+
194
+ if name in self.singletons:
195
+ # flatten! this 'promotes' the content of an inner dimension
196
+ # upwards, effectively hiding one nested dimension
197
+ output[name] = output[name]["content"]
198
+
199
+ return output.keys(), output.values()
200
+
201
+ @classmethod
202
+ def behavior(cls) -> Behavior:
203
+ """Behaviors necessary to implement this schema"""
204
+ from atlas_schema.methods import behavior as roaster
205
+
206
+ return roaster
@@ -0,0 +1,29 @@
1
+ """
2
+ Typing helpers.
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ import sys
8
+ from typing import Dict, Type
9
+
10
+ import awkward
11
+
12
+ if sys.version_info >= (3, 9):
13
+ from typing import Annotated
14
+ else:
15
+ from typing_extensions import Annotated
16
+
17
+ if sys.version_info >= (3, 10):
18
+ from typing import TypeAlias
19
+ else:
20
+ from typing_extensions import TypeAlias
21
+
22
+ if sys.version_info >= (3, 11):
23
+ from typing import Self
24
+ else:
25
+ from typing_extensions import Self
26
+
27
+ Behavior: TypeAlias = Dict[str, Type[awkward.Record]]
28
+
29
+ __all__ = ("Annotated", "Behavior", "Self")
@@ -0,0 +1,283 @@
1
+ Metadata-Version: 2.3
2
+ Name: atlas-schema
3
+ Version: 0.1.0
4
+ Summary: Helper python package for ATLAS Common NTuple Analysis work.
5
+ Project-URL: Homepage, https://github.com/scipp-atlas/atlas-schema
6
+ Project-URL: Bug Tracker, https://github.com/scipp-atlas/atlas-schema/issues
7
+ Project-URL: Discussions, https://github.com/scipp-atlas/atlas-schema/discussions
8
+ Project-URL: Changelog, https://github.com/scipp-atlas/atlas-schema/releases
9
+ Author-email: Giordon Stark <kratsg@gmail.com>
10
+ License:
11
+ Apache License
12
+ Version 2.0, January 2004
13
+ http://www.apache.org/licenses/
14
+
15
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
16
+
17
+ 1. Definitions.
18
+
19
+ "License" shall mean the terms and conditions for use, reproduction,
20
+ and distribution as defined by Sections 1 through 9 of this document.
21
+
22
+ "Licensor" shall mean the copyright owner or entity authorized by
23
+ the copyright owner that is granting the License.
24
+
25
+ "Legal Entity" shall mean the union of the acting entity and all
26
+ other entities that control, are controlled by, or are under common
27
+ control with that entity. For the purposes of this definition,
28
+ "control" means (i) the power, direct or indirect, to cause the
29
+ direction or management of such entity, whether by contract or
30
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
31
+ outstanding shares, or (iii) beneficial ownership of such entity.
32
+
33
+ "You" (or "Your") shall mean an individual or Legal Entity
34
+ exercising permissions granted by this License.
35
+
36
+ "Source" form shall mean the preferred form for making modifications,
37
+ including but not limited to software source code, documentation
38
+ source, and configuration files.
39
+
40
+ "Object" form shall mean any form resulting from mechanical
41
+ transformation or translation of a Source form, including but
42
+ not limited to compiled object code, generated documentation,
43
+ and conversions to other media types.
44
+
45
+ "Work" shall mean the work of authorship, whether in Source or
46
+ Object form, made available under the License, as indicated by a
47
+ copyright notice that is included in or attached to the work
48
+ (an example is provided in the Appendix below).
49
+
50
+ "Derivative Works" shall mean any work, whether in Source or Object
51
+ form, that is based on (or derived from) the Work and for which the
52
+ editorial revisions, annotations, elaborations, or other modifications
53
+ represent, as a whole, an original work of authorship. For the purposes
54
+ of this License, Derivative Works shall not include works that remain
55
+ separable from, or merely link (or bind by name) to the interfaces of,
56
+ the Work and Derivative Works thereof.
57
+
58
+ "Contribution" shall mean any work of authorship, including
59
+ the original version of the Work and any modifications or additions
60
+ to that Work or Derivative Works thereof, that is intentionally
61
+ submitted to Licensor for inclusion in the Work by the copyright owner
62
+ or by an individual or Legal Entity authorized to submit on behalf of
63
+ the copyright owner. For the purposes of this definition, "submitted"
64
+ means any form of electronic, verbal, or written communication sent
65
+ to the Licensor or its representatives, including but not limited to
66
+ communication on electronic mailing lists, source code control systems,
67
+ and issue tracking systems that are managed by, or on behalf of, the
68
+ Licensor for the purpose of discussing and improving the Work, but
69
+ excluding communication that is conspicuously marked or otherwise
70
+ designated in writing by the copyright owner as "Not a Contribution."
71
+
72
+ "Contributor" shall mean Licensor and any individual or Legal Entity
73
+ on behalf of whom a Contribution has been received by Licensor and
74
+ subsequently incorporated within the Work.
75
+
76
+ 2. Grant of Copyright License. Subject to the terms and conditions of
77
+ this License, each Contributor hereby grants to You a perpetual,
78
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
79
+ copyright license to reproduce, prepare Derivative Works of,
80
+ publicly display, publicly perform, sublicense, and distribute the
81
+ Work and such Derivative Works in Source or Object form.
82
+
83
+ 3. Grant of Patent License. Subject to the terms and conditions of
84
+ this License, each Contributor hereby grants to You a perpetual,
85
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
86
+ (except as stated in this section) patent license to make, have made,
87
+ use, offer to sell, sell, import, and otherwise transfer the Work,
88
+ where such license applies only to those patent claims licensable
89
+ by such Contributor that are necessarily infringed by their
90
+ Contribution(s) alone or by combination of their Contribution(s)
91
+ with the Work to which such Contribution(s) was submitted. If You
92
+ institute patent litigation against any entity (including a
93
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
94
+ or a Contribution incorporated within the Work constitutes direct
95
+ or contributory patent infringement, then any patent licenses
96
+ granted to You under this License for that Work shall terminate
97
+ as of the date such litigation is filed.
98
+
99
+ 4. Redistribution. You may reproduce and distribute copies of the
100
+ Work or Derivative Works thereof in any medium, with or without
101
+ modifications, and in Source or Object form, provided that You
102
+ meet the following conditions:
103
+
104
+ (a) You must give any other recipients of the Work or
105
+ Derivative Works a copy of this License; and
106
+
107
+ (b) You must cause any modified files to carry prominent notices
108
+ stating that You changed the files; and
109
+
110
+ (c) You must retain, in the Source form of any Derivative Works
111
+ that You distribute, all copyright, patent, trademark, and
112
+ attribution notices from the Source form of the Work,
113
+ excluding those notices that do not pertain to any part of
114
+ the Derivative Works; and
115
+
116
+ (d) If the Work includes a "NOTICE" text file as part of its
117
+ distribution, then any Derivative Works that You distribute must
118
+ include a readable copy of the attribution notices contained
119
+ within such NOTICE file, excluding those notices that do not
120
+ pertain to any part of the Derivative Works, in at least one
121
+ of the following places: within a NOTICE text file distributed
122
+ as part of the Derivative Works; within the Source form or
123
+ documentation, if provided along with the Derivative Works; or,
124
+ within a display generated by the Derivative Works, if and
125
+ wherever such third-party notices normally appear. The contents
126
+ of the NOTICE file are for informational purposes only and
127
+ do not modify the License. You may add Your own attribution
128
+ notices within Derivative Works that You distribute, alongside
129
+ or as an addendum to the NOTICE text from the Work, provided
130
+ that such additional attribution notices cannot be construed
131
+ as modifying the License.
132
+
133
+ You may add Your own copyright statement to Your modifications and
134
+ may provide additional or different license terms and conditions
135
+ for use, reproduction, or distribution of Your modifications, or
136
+ for any such Derivative Works as a whole, provided Your use,
137
+ reproduction, and distribution of the Work otherwise complies with
138
+ the conditions stated in this License.
139
+
140
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
141
+ any Contribution intentionally submitted for inclusion in the Work
142
+ by You to the Licensor shall be under the terms and conditions of
143
+ this License, without any additional terms or conditions.
144
+ Notwithstanding the above, nothing herein shall supersede or modify
145
+ the terms of any separate license agreement you may have executed
146
+ with Licensor regarding such Contributions.
147
+
148
+ 6. Trademarks. This License does not grant permission to use the trade
149
+ names, trademarks, service marks, or product names of the Licensor,
150
+ except as required for reasonable and customary use in describing the
151
+ origin of the Work and reproducing the content of the NOTICE file.
152
+
153
+ 7. Disclaimer of Warranty. Unless required by applicable law or
154
+ agreed to in writing, Licensor provides the Work (and each
155
+ Contributor provides its Contributions) on an "AS IS" BASIS,
156
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
157
+ implied, including, without limitation, any warranties or conditions
158
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
159
+ PARTICULAR PURPOSE. You are solely responsible for determining the
160
+ appropriateness of using or redistributing the Work and assume any
161
+ risks associated with Your exercise of permissions under this License.
162
+
163
+ 8. Limitation of Liability. In no event and under no legal theory,
164
+ whether in tort (including negligence), contract, or otherwise,
165
+ unless required by applicable law (such as deliberate and grossly
166
+ negligent acts) or agreed to in writing, shall any Contributor be
167
+ liable to You for damages, including any direct, indirect, special,
168
+ incidental, or consequential damages of any character arising as a
169
+ result of this License or out of the use or inability to use the
170
+ Work (including but not limited to damages for loss of goodwill,
171
+ work stoppage, computer failure or malfunction, or any and all
172
+ other commercial damages or losses), even if such Contributor
173
+ has been advised of the possibility of such damages.
174
+
175
+ 9. Accepting Warranty or Additional Liability. While redistributing
176
+ the Work or Derivative Works thereof, You may choose to offer,
177
+ and charge a fee for, acceptance of support, warranty, indemnity,
178
+ or other liability obligations and/or rights consistent with this
179
+ License. However, in accepting such obligations, You may act only
180
+ on Your own behalf and on Your sole responsibility, not on behalf
181
+ of any other Contributor, and only if You agree to indemnify,
182
+ defend, and hold each Contributor harmless for any liability
183
+ incurred by, or claims asserted against, such Contributor by reason
184
+ of your accepting any such warranty or additional liability.
185
+
186
+ END OF TERMS AND CONDITIONS
187
+
188
+ APPENDIX: How to apply the Apache License to your work.
189
+
190
+ To apply the Apache License to your work, attach the following
191
+ boilerplate notice, with the fields enclosed by brackets "[]"
192
+ replaced with your own identifying information. (Don't include
193
+ the brackets!) The text should be enclosed in the appropriate
194
+ comment syntax for the file format. We also recommend that a
195
+ file or class name and description of purpose be included on the
196
+ same "printed page" as the copyright notice for easier
197
+ identification within third-party archives.
198
+
199
+ Copyright 2024 Giordon Stark
200
+
201
+ Licensed under the Apache License, Version 2.0 (the "License");
202
+ you may not use this file except in compliance with the License.
203
+ You may obtain a copy of the License at
204
+
205
+ http://www.apache.org/licenses/LICENSE-2.0
206
+
207
+ Unless required by applicable law or agreed to in writing, software
208
+ distributed under the License is distributed on an "AS IS" BASIS,
209
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
210
+ See the License for the specific language governing permissions and
211
+ limitations under the License.
212
+ Classifier: Development Status :: 1 - Planning
213
+ Classifier: Intended Audience :: Developers
214
+ Classifier: Intended Audience :: Science/Research
215
+ Classifier: License :: OSI Approved :: Apache Software License
216
+ Classifier: Operating System :: OS Independent
217
+ Classifier: Programming Language :: Python
218
+ Classifier: Programming Language :: Python :: 3
219
+ Classifier: Programming Language :: Python :: 3 :: Only
220
+ Classifier: Programming Language :: Python :: 3.8
221
+ Classifier: Programming Language :: Python :: 3.9
222
+ Classifier: Programming Language :: Python :: 3.10
223
+ Classifier: Programming Language :: Python :: 3.11
224
+ Classifier: Programming Language :: Python :: 3.12
225
+ Classifier: Topic :: Scientific/Engineering
226
+ Classifier: Typing :: Typed
227
+ Requires-Python: >=3.8
228
+ Requires-Dist: coffea[dask]>=2024.4.1
229
+ Provides-Extra: dev
230
+ Requires-Dist: pytest-cov>=3; extra == 'dev'
231
+ Requires-Dist: pytest>=6; extra == 'dev'
232
+ Provides-Extra: docs
233
+ Requires-Dist: furo>=2023.08.17; extra == 'docs'
234
+ Requires-Dist: myst-parser>=0.13; extra == 'docs'
235
+ Requires-Dist: sphinx-autodoc-typehints; extra == 'docs'
236
+ Requires-Dist: sphinx-copybutton; extra == 'docs'
237
+ Requires-Dist: sphinx>=7.0; extra == 'docs'
238
+ Provides-Extra: test
239
+ Requires-Dist: build; extra == 'test'
240
+ Requires-Dist: pylint; extra == 'test'
241
+ Requires-Dist: pytest-cov>=3; extra == 'test'
242
+ Requires-Dist: pytest>=6; extra == 'test'
243
+ Requires-Dist: tbump>=6.7.0; extra == 'test'
244
+ Requires-Dist: twine; extra == 'test'
245
+ Description-Content-Type: text/markdown
246
+
247
+ # atlas-schema v0.1.0
248
+
249
+ [![Actions Status][actions-badge]][actions-link]
250
+ [![Documentation Status][rtd-badge]][rtd-link]
251
+
252
+ [![PyPI version][pypi-version]][pypi-link]
253
+ [![Conda-Forge][conda-badge]][conda-link]
254
+ [![PyPI platforms][pypi-platforms]][pypi-link]
255
+
256
+ [![GitHub Discussion][github-discussions-badge]][github-discussions-link]
257
+
258
+ <!-- SPHINX-START -->
259
+
260
+ <!-- prettier-ignore-start -->
261
+ [actions-badge]: https://github.com/scipp-atlas/atlas-schema/workflows/CI/badge.svg
262
+ [actions-link]: https://github.com/scipp-atlas/atlas-schema/actions
263
+ [conda-badge]: https://img.shields.io/conda/vn/conda-forge/atlas-schema
264
+ [conda-link]: https://github.com/conda-forge/atlas-schema-feedstock
265
+ [github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github
266
+ [github-discussions-link]: https://github.com/scipp-atlas/atlas-schema/discussions
267
+ [pypi-link]: https://pypi.org/project/atlas-schema/
268
+ [pypi-platforms]: https://img.shields.io/pypi/pyversions/atlas-schema
269
+ [pypi-version]: https://img.shields.io/pypi/v/atlas-schema
270
+ [rtd-badge]: https://readthedocs.org/projects/atlas-schema/badge/?version=latest
271
+ [rtd-link]: https://atlas-schema.readthedocs.io/en/latest/?badge=latest
272
+
273
+ <!-- prettier-ignore-end -->
274
+
275
+ ## Developer Notes
276
+
277
+ ### Converting Enums from C++ to Python
278
+
279
+ This useful `vim` substitution helps:
280
+
281
+ ```
282
+ %s/ \([A-Za-z]\+\)\s\+= \(\d\+\),\?/ \1: Annotated[int, "\1"] = \2
283
+ ```
@@ -0,0 +1,12 @@
1
+ atlas_schema/__init__.py,sha256=eba1N4_cWS5YzEOgDdCJGiPKqUtO-Vn7t8dYq0Q6gk8,354
2
+ atlas_schema/_version.py,sha256=IMl2Pr_Sy4LVRKy_Sm4CdwUl1Gryous6ncL96EMYsnM,411
3
+ atlas_schema/_version.pyi,sha256=j5kbzfm6lOn8BzASXWjGIA1yT0OlHTWqlbyZ8Si_o0E,118
4
+ atlas_schema/enums.py,sha256=RktHMdqNcjcqHOtXzRP5pnakhrfo0VfRl60Mqsa7i74,5522
5
+ atlas_schema/methods.py,sha256=Vo9pQ52ZVm13TBpJ6KiiDlN2kS1MMGBMLjwRPB62ces,4111
6
+ atlas_schema/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ atlas_schema/schema.py,sha256=YRVaiDa5Evl2HZ9CzH23d0-TLkvxqyvFQhn0ixyWCcw,7668
8
+ atlas_schema/typing_compat.py,sha256=ZEdCro9ZfwqyEXrcxpkgyQqmpPiiLFc6JhDr9qFlD4w,555
9
+ atlas_schema-0.1.0.dist-info/METADATA,sha256=tiETJp8Ho_BdhjcKHExLrsxt4_z-65d-ovTBszl6pU8,16445
10
+ atlas_schema-0.1.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
11
+ atlas_schema-0.1.0.dist-info/licenses/LICENSE,sha256=snem82NV8fgAi4DKaaUIfReaM5RqIWbH5OOXOvy40_w,11344
12
+ atlas_schema-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.26.3
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2024 Giordon Stark
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.