jevassert 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.
jevassert/runner.py ADDED
@@ -0,0 +1,159 @@
1
+ """Record predictions against a live endpoint, and replay them offline.
2
+
3
+ ``record`` calls Jev once per case and writes one JSONL line per case.
4
+ ``load_predictions`` reads that file back for ``check`` — CI runs on the
5
+ recording, so tests are deterministic, free and rate-limit free. Re-record
6
+ when the pack changes or when the model version is bumped.
7
+
8
+ Operational flags:
9
+
10
+ - ``resume_from`` — skip cases that already have a successful record (retry
11
+ only the errored ones); the merged output keeps pack order.
12
+ - ``rpm`` — requests-per-minute pacing for the early-access rate limit.
13
+ - ``shuffle_options`` — seed for a robustness pass that permutes Choice option
14
+ order (Score levels are ordinal and are never shuffled).
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ import json
20
+ import random
21
+ import threading
22
+ import time
23
+ from collections.abc import Callable
24
+ from concurrent.futures import ThreadPoolExecutor
25
+ from pathlib import Path
26
+ from typing import Any
27
+
28
+ from .client import JevClient, JevError
29
+ from .packs import Case, Pack
30
+
31
+
32
+ def record(
33
+ pack: Pack,
34
+ client: JevClient,
35
+ concurrency: int = 8,
36
+ limit: int | None = None,
37
+ progress: Callable[[int, int], None] | None = None,
38
+ model: str | None = None,
39
+ resume_from: dict[str, dict[str, Any]] | None = None,
40
+ rpm: int = 0,
41
+ shuffle_options: int | None = None,
42
+ ) -> list[dict[str, Any]]:
43
+ """Evaluate every case in ``pack``; returns records in case order.
44
+
45
+ Auth failures (401/403, missing key) abort immediately instead of burning
46
+ one failed request per case.
47
+ """
48
+ if not client.api_key:
49
+ raise JevError("TYPESAFE_API_KEY is not set (env var or api_key=)")
50
+
51
+ selected: tuple[Case, ...] = pack.cases[:limit] if limit else pack.cases
52
+ api_questions = pack.to_api_questions()
53
+ if shuffle_options is not None:
54
+ api_questions = shuffle_choice_options(api_questions, shuffle_options)
55
+ api_model = model or pack.record_model
56
+ limiter = _RateLimiter(rpm) if rpm and rpm > 0 else None
57
+
58
+ existing = resume_from or {}
59
+ done = {case_id for case_id, item in existing.items() if not item.get("error")}
60
+ pending = [case for case in selected if case.id not in done]
61
+ completed = 0
62
+
63
+ def evaluate(case: Case) -> dict[str, Any]:
64
+ nonlocal completed
65
+ if limiter:
66
+ limiter.wait()
67
+ try:
68
+ response, latency_ms = client.system_one(case.state, api_questions, api_model)
69
+ except JevError as exc:
70
+ if exc.is_auth_error:
71
+ raise
72
+ result = {
73
+ "case_id": case.id,
74
+ "model": None,
75
+ "latency_ms": None,
76
+ "usage": None,
77
+ "answers": None,
78
+ "error": str(exc),
79
+ }
80
+ else:
81
+ result = {
82
+ "case_id": case.id,
83
+ "model": response.get("model"),
84
+ "latency_ms": round(latency_ms, 1),
85
+ "usage": response.get("usage"),
86
+ "answers": response.get("answers"),
87
+ "error": None,
88
+ }
89
+ completed += 1
90
+ if progress:
91
+ progress(completed, len(pending))
92
+ return result
93
+
94
+ with ThreadPoolExecutor(max_workers=max(1, concurrency)) as pool:
95
+ fresh = list(pool.map(evaluate, pending))
96
+
97
+ by_id = {item["case_id"]: item for item in existing.values()}
98
+ by_id.update({item["case_id"]: item for item in fresh})
99
+ return [by_id[case.id] for case in selected if case.id in by_id]
100
+
101
+
102
+ def shuffle_choice_options(questions: dict[str, Any], seed: int) -> dict[str, Any]:
103
+ """Permute Choice option order deterministically (Score levels stay ordered)."""
104
+ rng = random.Random(seed)
105
+ shuffled: dict[str, Any] = {}
106
+ for qid, question in questions.items():
107
+ if question.get("type") == "choice" and isinstance(question.get("criteria"), dict):
108
+ items = list(question["criteria"].items())
109
+ rng.shuffle(items)
110
+ question = {**question, "criteria": dict(items)}
111
+ shuffled[qid] = question
112
+ return shuffled
113
+
114
+
115
+ class _RateLimiter:
116
+ """Simple global pacer: at most ``rpm`` request starts per minute."""
117
+
118
+ def __init__(self, rpm: int) -> None:
119
+ self.min_interval = 60.0 / rpm
120
+ self._lock = threading.Lock()
121
+ self._next_start = 0.0
122
+
123
+ def wait(self) -> None:
124
+ with self._lock:
125
+ now = time.monotonic()
126
+ delay = max(0.0, self._next_start - now)
127
+ self._next_start = max(now, self._next_start) + self.min_interval
128
+ if delay:
129
+ time.sleep(delay)
130
+
131
+
132
+ def write_predictions(path: str | Path, records: list[dict[str, Any]]) -> None:
133
+ path = Path(path)
134
+ with path.open("w", encoding="utf-8") as handle:
135
+ for record in records:
136
+ handle.write(json.dumps(record, ensure_ascii=False) + "\n")
137
+
138
+
139
+ def load_predictions(path: str | Path) -> dict[str, dict[str, Any]]:
140
+ """Read a predictions JSONL file, keyed by case id."""
141
+ path = Path(path)
142
+ if not path.is_file():
143
+ raise FileNotFoundError(f"predictions file not found: {path}")
144
+ predictions: dict[str, dict[str, Any]] = {}
145
+ for lineno, line in enumerate(path.read_text(encoding="utf-8").splitlines(), 1):
146
+ line = line.strip()
147
+ if not line:
148
+ continue
149
+ try:
150
+ record = json.loads(line)
151
+ except json.JSONDecodeError as exc:
152
+ raise ValueError(f"{path}:{lineno}: invalid JSON: {exc}") from exc
153
+ case_id = record.get("case_id")
154
+ if not isinstance(case_id, str) or not case_id:
155
+ raise ValueError(f"{path}:{lineno}: case_id is required")
156
+ if case_id in predictions:
157
+ raise ValueError(f"{path}:{lineno}: duplicate case_id '{case_id}'")
158
+ predictions[case_id] = record
159
+ return predictions
@@ -0,0 +1,194 @@
1
+ Metadata-Version: 2.5
2
+ Name: jevassert
3
+ Version: 0.1.0
4
+ Summary: Record/replay regression tests for Jev (TypeSafe System One) question packs — accuracy, calibration and cost gates in CI.
5
+ Project-URL: Homepage, https://github.com/dtduc-git/jevassert
6
+ Project-URL: Issues, https://github.com/dtduc-git/jevassert/issues
7
+ Project-URL: Changelog, https://github.com/dtduc-git/jevassert/releases
8
+ Author-email: Duke - Duc Dinh <dtduc.contact@gmail.com>
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: calibration,ci,decisions,evals,jev,structured-output,system-one,testing,typesafe
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Quality Assurance
21
+ Classifier: Topic :: Software Development :: Testing
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: httpx>=0.27
24
+ Requires-Dist: pyyaml>=6.0
25
+ Description-Content-Type: text/markdown
26
+
27
+ # jevassert
28
+
29
+ [![CI](https://github.com/dtduc-git/jevassert/actions/workflows/ci.yml/badge.svg)](https://github.com/dtduc-git/jevassert/actions/workflows/ci.yml)
30
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
31
+
32
+ Regression tests for [Jev](https://typesafe.ai) question packs: assert
33
+ **accuracy, calibration and cost** in CI, with recordings so runs are
34
+ deterministic, free and rate-limit free.
35
+
36
+ > Independent community tool. Not affiliated with TypeSafe AI.
37
+
38
+ Jev returns typed decisions with probabilities, which means two things your
39
+ normal test suite cannot check: *does the decision match the labels*, and
40
+ *does the stated probability mean what it says*. jevassert checks both — and
41
+ never calls the model during `check`, because CI should run on a recording.
42
+
43
+ ```
44
+ record → predictions.jsonl → check (offline, deterministic) → exit 0/1/2
45
+ ```
46
+
47
+ ## Quickstart
48
+
49
+ ```sh
50
+ uvx jevassert record examples/demo-triage -o triage.jsonl # needs TYPESAFE_API_KEY
51
+ uvx jevassert check examples/demo-triage -p triage.jsonl --failures
52
+ ```
53
+
54
+ `record` calls Jev once per case (concurrently, with retries) and writes one
55
+ JSONL line per case — model version, usage, latency, answers. `check` replays
56
+ that file: no API key, no network, same result every time.
57
+
58
+ Re-record when the pack questions, the gates or the model version change, then
59
+ compare:
60
+
61
+ ```sh
62
+ uvx jevassert record examples/demo-triage -o triage-next.jsonl
63
+ uvx jevassert compare examples/demo-triage --a triage.jsonl --b triage-next.jsonl
64
+ ```
65
+
66
+ ## Packs
67
+
68
+ A pack follows **spec v0** (canonical:
69
+ [jev-packs/SPEC.md](https://github.com/dtduc-git/jev-packs/blob/master/SPEC.md)):
70
+
71
+ ```
72
+ examples/demo-triage/
73
+ pack.yaml # state contract, questions, optional threshold floors
74
+ cases.jsonl # {"id", "state", "expect"} per line
75
+ gates.yaml # optional — jevassert quality gates
76
+ ```
77
+
78
+ Questions are the SPEC shapes — `noul`, `choice` (`options`), `score`
79
+ (`levels`) — and every closed set must include the label `unknown` (Jev cannot
80
+ abstain). Score levels may carry `level_descriptions` so the API gets
81
+ situational text instead of bare keys:
82
+
83
+ ```yaml
84
+ questions:
85
+ queue:
86
+ type: choice
87
+ instructions: Which team should handle this message?
88
+ options: {billing: ..., technical: ..., unknown: Cannot tell.}
89
+ urgency:
90
+ type: score
91
+ instructions: How soon does this need a human response?
92
+ levels: [low, normal, high, unknown]
93
+ level_descriptions:
94
+ low: No stated impact or time pressure; can wait.
95
+ high: Stated impact or time pressure; needs a response today.
96
+ ```
97
+
98
+ `thresholds` in the pack are the author's recommended operating point
99
+ (per-label probability floors; labels without a floor always go to review).
100
+
101
+ Gates live in `gates.yaml`, so the quality contract is explicit:
102
+
103
+ ```yaml
104
+ min_accuracy: 0.85
105
+ max_ece: 0.15
106
+ max_cost_per_case_usd: 0.001
107
+ max_p95_latency_ms: 800
108
+ min_coverage_at_precision: {precision: 0.9, min_coverage: 0.6}
109
+ min_accuracy_ci_lower: 0.8 # bootstrap CI lower bound (n small-safe gate)
110
+ per_question:
111
+ queue: {min_accuracy: 0.9, max_ece: 0.1}
112
+ ```
113
+
114
+ ## What `check` reports
115
+
116
+ - **accuracy** per question and overall, with a **bootstrap 95% CI**
117
+ (`--bootstrap N`, default 1000; `0` disables)
118
+ - **ECE** — expected calibration error of the decision probability, equal-mass
119
+ bins (meaningful with a few hundred items; small packs get a warning)
120
+ - **Brier** — for Noul questions
121
+ - **coverage** — accept when `p >= threshold`: how much you automate, at what
122
+ precision
123
+ - **author thresholds** — auto-accept coverage under the pack's own floors
124
+ - **threshold suggestion** — `--target-precision 0.95` finds the highest-coverage
125
+ cut that still reaches that precision
126
+ - **cost and latency** — dollars per case and p50/p95, from the recording
127
+ - **`--failures`** — every mismatch with expected/got/probability and the state
128
+
129
+ `check` warns when the recording's model version differs from `pack.tested`,
130
+ when cases are missing or extra, and when `tested` is still null.
131
+
132
+ Exit codes: `0` all gates pass, `1` a gate failed, `2` usage/IO error.
133
+ `--junit FILE` writes JUnit XML; `--report FILE` writes a markdown report
134
+ (the spec's `evidence.md`); `--json` prints machine-readable metrics.
135
+
136
+ ## GitHub Action
137
+
138
+ ```yaml
139
+ - uses: dtduc-git/jevassert@v0
140
+ with:
141
+ pack: examples/demo-triage
142
+ predictions: triage.jsonl
143
+ report: jevassert-report.md
144
+ ```
145
+
146
+ Record outside CI (or as a scheduled job), commit the predictions file, and
147
+ the Action enforces the gates on every pull request.
148
+
149
+ ## Commands
150
+
151
+ | command | what it does |
152
+ |---|---|
153
+ | `jevassert record PACK -o FILE [--model M] [--resume] [--rpm N] [--dry-run] [--shuffle-options SEED] [--repeat N]` | call Jev for every case, write predictions JSONL |
154
+ | `jevassert check PACK -p FILE [--failures] [--bootstrap N] [--target-precision P] [--partition dev\|test]` | compute metrics, evaluate gates, exit 0/1/2 |
155
+ | `jevassert compare PACK --a A --b B` | paired accuracy deltas + exact McNemar p-value |
156
+
157
+ `record` extras: `--dry-run` estimates tokens/cost from the pack without sending
158
+ anything; `--resume` retries only cases that errored; `--rpm` paces requests;
159
+ `--shuffle-options` records a robustness pass with permuted Choice option order
160
+ (Score levels stay ordinal) — compare it against the base recording; `--repeat N`
161
+ records N independent rounds (`FILE-r2.jsonl`, ...) and prints the discordant
162
+ decision count across rounds.
163
+
164
+ `check --partition dev|test` evaluates only one deterministic hash-split half
165
+ (`--partition-seed`, `--partition-ratio`) — tune thresholds on dev, then verify
166
+ on test without fooling yourself.
167
+
168
+ Environment: `TYPESAFE_API_KEY` (record only), `TYPESAFE_BASE_URL` (override
169
+ the endpoint, e.g. a local Jev-compatible replica).
170
+
171
+ ## Reading the numbers
172
+
173
+ - Accuracy on <30 items per question is noisy (±19pp at n=10). Prefer packs
174
+ with 100+ items per question before gating on tight thresholds, and let
175
+ `--bootstrap` show the CI — gate on `min_accuracy_ci_lower` when n is small.
176
+ - ECE needs a few hundred items to be meaningful; with small n the bins
177
+ collapse to per-item gaps. Treat it as a smoke signal, not a measurement.
178
+ - Stability: record twice and `compare` — the flip rate is your run-to-run
179
+ noise floor. Question wording, option order and model version all move it;
180
+ `--shuffle-options` isolates the option-order effect and `--repeat N` prints
181
+ the flip rate automatically.
182
+ - Threshold tuning: suggest on one half, verify on the other —
183
+ `check --target-precision 0.95 --partition dev`, then `--partition test`.
184
+ (CIs are percentile bootstrap; with heavily tied probabilities the ECE CI can
185
+ be slightly skewed.)
186
+
187
+ ## Scope
188
+
189
+ - Backend-neutral: anything that speaks the System One request/response shape.
190
+ - File-based and offline-first: no server, no database, no telemetry.
191
+ - Not a labeling tool, not a dashboard, not an observability product.
192
+
193
+ `jevassert.packs` is the reference loader/validator for SPEC v0 and is meant
194
+ to be imported by other tools (jev-table, packs CI).
@@ -0,0 +1,14 @@
1
+ jevassert/__init__.py,sha256=g7nS1fVjWrA6PC90gOX8KET_1YnibZj0z-ReSEYTA0E,98
2
+ jevassert/__main__.py,sha256=k1ocEWawweo1qCJWNFAAvyxz3tcY13dzvCenHszij30,48
3
+ jevassert/cli.py,sha256=hhDED7PSweGzL2VJ4_LI6lyoAgviPJzzp1xYPKhyqE4,20215
4
+ jevassert/client.py,sha256=2HR81GckC5coK1dQJ3IbYmnCft2vwkj6IUD3aqoLfgM,5140
5
+ jevassert/compare.py,sha256=zTzSkvGu5TLH21pyN53Vj1AT_VdKuVBj8A0XOj6X4K4,3594
6
+ jevassert/metrics.py,sha256=zpEp0jfEM08rCh4lV40xbYIui7UGj3cudY4iEFiXUU4,17861
7
+ jevassert/packs.py,sha256=gSaTJU84CP64Tcfopu3ZZMaeoylg2QFaRBXtk1XHTHo,18237
8
+ jevassert/report.py,sha256=gGUgiypi1oPm9Swg3y9CEuRdI6HEmBrdEG1gwL3Bin4,5149
9
+ jevassert/runner.py,sha256=Th3cvmBaEPb0QyuqvarmmA8qAWcHyroUzPzZ0pjVe9o,5820
10
+ jevassert-0.1.0.dist-info/METADATA,sha256=H3Tq0XToe_NkWFeGuoFO-mWsODYvtoNKt4aRd16BkbU,8233
11
+ jevassert-0.1.0.dist-info/WHEEL,sha256=THafob7ofN-NsuMN7Mg4qZyHaQI7KkD-QlcQatYhXPo,87
12
+ jevassert-0.1.0.dist-info/entry_points.txt,sha256=Zo0NHzrA4nrs74mvWCCf3oxynQmg1frHv-fiJwGIwZg,49
13
+ jevassert-0.1.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
14
+ jevassert-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.3
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ jevassert = jevassert.cli:main
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.