sqlquack 0.3.0__cp312-abi3-win_amd64.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.
- sqlquack/__init__.py +23 -0
- sqlquack/_native.pyd +4 -0
- sqlquack/_native.pyi +9 -0
- sqlquack/api/__init__.py +1 -0
- sqlquack/api/_helpers/__init__.py +1 -0
- sqlquack/api/_helpers/reports.py +41 -0
- sqlquack/api/constants.py +5 -0
- sqlquack/api/exceptions.py +7 -0
- sqlquack/api/main/__init__.py +1 -0
- sqlquack/api/main/check.py +21 -0
- sqlquack/api/main/convert.py +48 -0
- sqlquack/api/main/udf.py +16 -0
- sqlquack/api/models.py +80 -0
- sqlquack/py.typed +0 -0
- sqlquack-0.3.0.dist-info/METADATA +9 -0
- sqlquack-0.3.0.dist-info/RECORD +20 -0
- sqlquack-0.3.0.dist-info/WHEEL +4 -0
- sqlquack-0.3.0.dist-info/licenses/LICENSE +201 -0
- sqlquack-0.3.0.dist-info/licenses/THIRD_PARTY_NOTICES +178 -0
- sqlquack-0.3.0.dist-info/sboms/sqlquack-python.cyclonedx.json +6742 -0
sqlquack/__init__.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Check Snowflake SQL and convert it into DuckDB SQL, as the sqlquack command line does."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from sqlquack._native import __version__
|
|
6
|
+
from sqlquack.api.exceptions import SqlQuackError
|
|
7
|
+
from sqlquack.api.main.check import check
|
|
8
|
+
from sqlquack.api.main.convert import convert
|
|
9
|
+
from sqlquack.api.main.udf import udf
|
|
10
|
+
from sqlquack.api.models import CheckResult, Conversion, ConvertOptions, Diagnostic, Span
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"CheckResult",
|
|
14
|
+
"Conversion",
|
|
15
|
+
"ConvertOptions",
|
|
16
|
+
"Diagnostic",
|
|
17
|
+
"Span",
|
|
18
|
+
"SqlQuackError",
|
|
19
|
+
"__version__",
|
|
20
|
+
"check",
|
|
21
|
+
"convert",
|
|
22
|
+
"udf",
|
|
23
|
+
]
|
sqlquack/_native.pyd
ADDED
sqlquack/_native.pyi
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""The native module the ``sqlquack`` package wraps; use the package's functions instead."""
|
|
2
|
+
|
|
3
|
+
__version__: str
|
|
4
|
+
|
|
5
|
+
def check_json(sql: str, path: str) -> str:
|
|
6
|
+
"""``{"report": <check --json report>, "rendered": <text>}``; ``ValueError`` without SQL."""
|
|
7
|
+
|
|
8
|
+
def convert_json(sql: str, request: str, path: str) -> str:
|
|
9
|
+
"""``{"report": <convert --json report>, "rendered": <text>}``; ``ValueError`` on exit 2."""
|
sqlquack/api/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""The sqlquack API: `check` and `convert`, mirroring the command line."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""api _helpers package."""
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""The native module's JSON reports as typed results."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
from collections.abc import Callable, Mapping
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from sqlquack.api.exceptions import SqlQuackError
|
|
11
|
+
from sqlquack.api.models import Diagnostic, Span
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def loaded(call: Callable[[], str]) -> dict[str, Any]:
|
|
15
|
+
"""The native call's JSON, with its errors raised as `SqlQuackError`."""
|
|
16
|
+
try:
|
|
17
|
+
text: str = call()
|
|
18
|
+
except ValueError as error:
|
|
19
|
+
raise SqlQuackError(str(error)) from None
|
|
20
|
+
return json.loads(text)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def path_argument(value: str | os.PathLike[str] | None) -> str | None:
|
|
24
|
+
"""A path argument as the native module takes it."""
|
|
25
|
+
return None if value is None else os.fspath(value)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def diagnostic(fields: Mapping[str, Any]) -> Diagnostic:
|
|
29
|
+
"""A diagnostic from its JSON fields."""
|
|
30
|
+
span: Mapping[str, int] | None = fields["span"]
|
|
31
|
+
return Diagnostic(
|
|
32
|
+
code=fields["code"],
|
|
33
|
+
name=fields["name"],
|
|
34
|
+
alias=fields["alias"],
|
|
35
|
+
severity=fields["severity"],
|
|
36
|
+
message=fields["message"],
|
|
37
|
+
span=None if span is None else Span(**span),
|
|
38
|
+
label=fields["label"],
|
|
39
|
+
notes=tuple(fields["notes"]),
|
|
40
|
+
help=fields["help"],
|
|
41
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""api main package."""
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""`check`: what `sqlquack check` reports."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from sqlquack._native import check_json
|
|
8
|
+
from sqlquack.api._helpers.reports import diagnostic, loaded
|
|
9
|
+
from sqlquack.api.constants import DEFAULT_PATH
|
|
10
|
+
from sqlquack.api.models import CheckResult
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def check(*, sql: str, path: str = DEFAULT_PATH) -> CheckResult:
|
|
14
|
+
"""Parse `sql` and find what Snowflake rejects, naming it `path`; no SQL raises."""
|
|
15
|
+
result: dict[str, Any] = loaded(lambda: check_json(sql, path))
|
|
16
|
+
report: dict[str, Any] = result["report"]
|
|
17
|
+
return CheckResult(
|
|
18
|
+
ok=report["ok"],
|
|
19
|
+
diagnostics=tuple(diagnostic(found) for found in report["diagnostics"]),
|
|
20
|
+
rendered=result["rendered"],
|
|
21
|
+
)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""`convert`: what `sqlquack convert` reports, with one option per command-line flag."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from sqlquack._native import convert_json
|
|
9
|
+
from sqlquack.api._helpers.reports import diagnostic, loaded, path_argument
|
|
10
|
+
from sqlquack.api.constants import DEFAULT_PATH
|
|
11
|
+
from sqlquack.api.models import Conversion, ConvertOptions
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def convert(
|
|
15
|
+
*, sql: str, options: ConvertOptions | None = None, path: str = DEFAULT_PATH
|
|
16
|
+
) -> Conversion:
|
|
17
|
+
"""Convert `sql` or refuse it as `sqlquack convert` does; exit-2 failures raise."""
|
|
18
|
+
chosen: ConvertOptions = options or ConvertOptions()
|
|
19
|
+
request: dict[str, Any] = {
|
|
20
|
+
"project": path_argument(chosen.project),
|
|
21
|
+
"schema": None if chosen.schema is None else dict(chosen.schema),
|
|
22
|
+
"policy": path_argument(chosen.policy),
|
|
23
|
+
"builtin_policy": chosen.builtin_policy,
|
|
24
|
+
"session": dict(chosen.session),
|
|
25
|
+
"strict": chosen.strict,
|
|
26
|
+
"utc_session": chosen.utc_session,
|
|
27
|
+
"confirm_declared_offsets": chosen.confirm_declared_offsets,
|
|
28
|
+
"python_runtime": chosen.python_runtime,
|
|
29
|
+
"loud_divergences_only": chosen.loud_divergences_only,
|
|
30
|
+
"overrides": path_argument(chosen.overrides),
|
|
31
|
+
"verified_overrides": dict(chosen.verified_overrides),
|
|
32
|
+
"compact": chosen.compact,
|
|
33
|
+
}
|
|
34
|
+
result: dict[str, Any] = loaded(lambda: convert_json(sql, json.dumps(request), path))
|
|
35
|
+
report: dict[str, Any] = result["report"]
|
|
36
|
+
return Conversion(
|
|
37
|
+
converted=report["converted"],
|
|
38
|
+
sql=report["sql"],
|
|
39
|
+
macros=tuple(report["macros"]),
|
|
40
|
+
profile=report["profile"],
|
|
41
|
+
diagnostics=tuple(diagnostic(refusal) for refusal in report["refusals"]),
|
|
42
|
+
divergences={name: tuple(uses) for name, uses in report["divergences"].items()},
|
|
43
|
+
assumptions=tuple(report["assumptions"]),
|
|
44
|
+
divergence_failures=dict(report["divergence_failures"]),
|
|
45
|
+
notes=tuple(report["notes"]),
|
|
46
|
+
rendered=result["rendered"],
|
|
47
|
+
report=report,
|
|
48
|
+
)
|
sqlquack/api/main/udf.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""`udf`: marks a project's Python function, as SQLBuild's `sqlbuild.functions.udf` does."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections.abc import Callable
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def udf(**kwargs: object) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
|
|
10
|
+
"""Mark a Python function as a project function; its keywords are read statically."""
|
|
11
|
+
del kwargs
|
|
12
|
+
|
|
13
|
+
def _decorate(function: Callable[..., Any]) -> Callable[..., Any]:
|
|
14
|
+
return function
|
|
15
|
+
|
|
16
|
+
return _decorate
|
sqlquack/api/models.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"""Diagnostics and results, as the command line reports them."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
from collections.abc import Mapping
|
|
7
|
+
from dataclasses import dataclass, field
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True)
|
|
12
|
+
class Span:
|
|
13
|
+
"""Where a diagnostic points: character offsets, then one-based line and column positions."""
|
|
14
|
+
|
|
15
|
+
start: int
|
|
16
|
+
end: int
|
|
17
|
+
line: int
|
|
18
|
+
column: int
|
|
19
|
+
end_line: int
|
|
20
|
+
end_column: int
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass(frozen=True)
|
|
24
|
+
class Diagnostic:
|
|
25
|
+
"""One coded problem; `span` is absent only for problems outside the SQL, like sessions."""
|
|
26
|
+
|
|
27
|
+
code: str
|
|
28
|
+
name: str
|
|
29
|
+
alias: str | None
|
|
30
|
+
severity: str
|
|
31
|
+
message: str
|
|
32
|
+
span: Span | None
|
|
33
|
+
label: str
|
|
34
|
+
notes: tuple[str, ...]
|
|
35
|
+
help: str | None
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@dataclass(frozen=True)
|
|
39
|
+
class CheckResult:
|
|
40
|
+
"""What `check` found, with `rendered` as the command line prints it."""
|
|
41
|
+
|
|
42
|
+
ok: bool
|
|
43
|
+
diagnostics: tuple[Diagnostic, ...]
|
|
44
|
+
rendered: str
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@dataclass(frozen=True)
|
|
48
|
+
class Conversion:
|
|
49
|
+
"""DuckDB SQL or the refusing diagnostics; `report` is exactly `convert --json`'s."""
|
|
50
|
+
|
|
51
|
+
converted: bool
|
|
52
|
+
sql: str
|
|
53
|
+
macros: tuple[str, ...]
|
|
54
|
+
profile: str
|
|
55
|
+
diagnostics: tuple[Diagnostic, ...]
|
|
56
|
+
divergences: Mapping[str, tuple[str, ...]]
|
|
57
|
+
assumptions: tuple[str, ...]
|
|
58
|
+
divergence_failures: Mapping[str, str]
|
|
59
|
+
notes: tuple[str, ...]
|
|
60
|
+
rendered: str
|
|
61
|
+
report: Mapping[str, Any]
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass(frozen=True)
|
|
65
|
+
class ConvertOptions:
|
|
66
|
+
"""The `sqlquack convert` flags, one field each, and `schema`, declarations held in memory."""
|
|
67
|
+
|
|
68
|
+
project: str | os.PathLike[str] | None = None
|
|
69
|
+
schema: Mapping[str, Any] | None = None
|
|
70
|
+
policy: str | os.PathLike[str] | None = None
|
|
71
|
+
builtin_policy: bool = False
|
|
72
|
+
session: Mapping[str, str] = field(default_factory=dict)
|
|
73
|
+
strict: bool = False
|
|
74
|
+
utc_session: bool = False
|
|
75
|
+
confirm_declared_offsets: bool = False
|
|
76
|
+
python_runtime: bool = False
|
|
77
|
+
loud_divergences_only: bool = False
|
|
78
|
+
overrides: str | os.PathLike[str] | None = None
|
|
79
|
+
verified_overrides: Mapping[str, str] = field(default_factory=dict)
|
|
80
|
+
compact: bool = False
|
sqlquack/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sqlquack
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Requires-Dist: sqlquack-cli==0.3.0
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
License-File: THIRD_PARTY_NOTICES
|
|
7
|
+
Summary: Check Snowflake SQL and convert it into DuckDB SQL, or refuse it with coded diagnostics.
|
|
8
|
+
License-Expression: Apache-2.0 AND MIT
|
|
9
|
+
Requires-Python: >=3.12
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
sqlquack/__init__.py,sha256=8suGQHnRi7odGAKCF1kb2Mi-hh92R4IzImSIlGoDNec,643
|
|
2
|
+
sqlquack/_native.pyd,sha256=j90zpdLVNpbJBLBfgiWBV15nLm5eqFzUjjLDl4aRt0s,67441664
|
|
3
|
+
sqlquack/_native.pyi,sha256=L6_qh8XLQTuTikI8HMo3RZBAQn3ujRP-kxS4IY9vwxg,420
|
|
4
|
+
sqlquack/api/__init__.py,sha256=7JytRgm1iutdMCgdz7dX3uznwmzJEN5Pe9UeV97hy7E,76
|
|
5
|
+
sqlquack/api/_helpers/__init__.py,sha256=uShqKKzf9Q-mlGQSDzq-sACrkd58wMS7RlukCHRhUnI,29
|
|
6
|
+
sqlquack/api/_helpers/reports.py,sha256=0NAFTAOHTvhK1tbkcDQgmkKo7KAYZXegUn0lctPXFXU,1288
|
|
7
|
+
sqlquack/api/constants.py,sha256=t6NEUY8Ro3ig6rfv22SgTAWFO74l4ceOhzcwhYvXxeM,109
|
|
8
|
+
sqlquack/api/exceptions.py,sha256=tTFdS3rmEpX1FgabG7rOzbuKNC5dQh-_ZYND_6DUXbg,206
|
|
9
|
+
sqlquack/api/main/__init__.py,sha256=Ra5ZTysl9K1B5sxiJ0UquadaD8EY70ltKhYSyWp7loA,25
|
|
10
|
+
sqlquack/api/main/check.py,sha256=oTFcAPW77EgCOPedktBhl6CSjR8E2LJmIfVLvdy4u58,762
|
|
11
|
+
sqlquack/api/main/convert.py,sha256=McGxCQPzayEzLq5eB5Y7tRZc5eTdpi-U6pPIzJORjmc,2092
|
|
12
|
+
sqlquack/api/main/udf.py,sha256=b_6jg63sXMuSQ4q9WE0JB9zorVAsy1vZ1mbsdhlJF88,512
|
|
13
|
+
sqlquack/api/models.py,sha256=06fY06aZVai_lrrXfVLTkGnAe9Blhp3tRDr9uoaeKEM,2187
|
|
14
|
+
sqlquack/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
+
sqlquack-0.3.0.dist-info/METADATA,sha256=AvTpu-ymTAPNYoBPeeFzdIfv0DmuXcY72ndhMXhtLU0,304
|
|
16
|
+
sqlquack-0.3.0.dist-info/WHEEL,sha256=frxxrLnlIAj9_4xWoM1LytQSnn-rPtE_w9IecHETOYQ,96
|
|
17
|
+
sqlquack-0.3.0.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
18
|
+
sqlquack-0.3.0.dist-info/licenses/THIRD_PARTY_NOTICES,sha256=Zoz6ipNhJYVDhgYRTOq3JSHSV17k7b_lJ_15CTAzu2I,9508
|
|
19
|
+
sqlquack-0.3.0.dist-info/sboms/sqlquack-python.cyclonedx.json,sha256=-ojL2jw3yLgrIl9xfYhMmG-g6iXKnauTJc7vbavrxns,216645
|
|
20
|
+
sqlquack-0.3.0.dist-info/RECORD,,
|
|
@@ -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.
|