selective-deps 1.7.1__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.
- selective_deps/__init__.py +66 -0
- selective_deps/models.py +35 -0
- selective_deps/parser.py +136 -0
- selective_deps/py.typed +0 -0
- selective_deps-1.7.1.dist-info/METADATA +70 -0
- selective_deps-1.7.1.dist-info/RECORD +8 -0
- selective_deps-1.7.1.dist-info/WHEEL +4 -0
- selective_deps-1.7.1.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""Parse dependency declarations without pytest, Git, caches or language analysis.
|
|
2
|
+
|
|
3
|
+
Callers provide tracked paths and manifest bytes, then combine the returned edges
|
|
4
|
+
with their language's import graph. Content nodes are leaves, not executable imports.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from collections.abc import Collection, Mapping
|
|
8
|
+
|
|
9
|
+
from .models import (
|
|
10
|
+
CONTENTS_PREFIX,
|
|
11
|
+
DependencyInputs,
|
|
12
|
+
DependencyManifest,
|
|
13
|
+
ManifestDependencyRule,
|
|
14
|
+
contents_node,
|
|
15
|
+
file_of,
|
|
16
|
+
)
|
|
17
|
+
from .parser import (
|
|
18
|
+
DIRECTORY_MANIFEST,
|
|
19
|
+
SIDECAR_SUFFIX,
|
|
20
|
+
DependencyDeclarationError,
|
|
21
|
+
is_declaration,
|
|
22
|
+
manifest_edges,
|
|
23
|
+
match_inputs,
|
|
24
|
+
parse_manifest,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
__all__ = [
|
|
28
|
+
"CONTENTS_PREFIX",
|
|
29
|
+
"DIRECTORY_MANIFEST",
|
|
30
|
+
"SIDECAR_SUFFIX",
|
|
31
|
+
"DependencyDeclarationError",
|
|
32
|
+
"DependencyInputs",
|
|
33
|
+
"DependencyManifest",
|
|
34
|
+
"ManifestDependencyRule",
|
|
35
|
+
"contents_node",
|
|
36
|
+
"dependency_edges",
|
|
37
|
+
"file_of",
|
|
38
|
+
"is_declaration",
|
|
39
|
+
"manifest_edges",
|
|
40
|
+
"match_inputs",
|
|
41
|
+
"parse_manifest",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def dependency_edges(
|
|
46
|
+
manifests: Mapping[str, bytes], files: Collection[str], *, revision: str = "inputs"
|
|
47
|
+
) -> dict[str, set[str]]:
|
|
48
|
+
"""Validated reader-to-input edges from one consistent repository snapshot.
|
|
49
|
+
|
|
50
|
+
``files`` includes every tracked file, including declarations. ``manifests``
|
|
51
|
+
supplies the bytes of every declaration in that inventory. Missing bytes,
|
|
52
|
+
invalid patterns and patterns matching no files are authoring errors.
|
|
53
|
+
No files are opened, Git commands run, or Python modules analyzed here.
|
|
54
|
+
"""
|
|
55
|
+
inventory = set(files)
|
|
56
|
+
expected = {path for path in inventory if is_declaration(path)}
|
|
57
|
+
if set(manifests) != expected:
|
|
58
|
+
raise DependencyDeclarationError(
|
|
59
|
+
f"{revision}: declaration inventory mismatch; missing {sorted(expected - set(manifests))}, "
|
|
60
|
+
f"unexpected {sorted(set(manifests) - expected)}"
|
|
61
|
+
)
|
|
62
|
+
edges: dict[str, set[str]] = {}
|
|
63
|
+
for path, source in sorted(manifests.items()):
|
|
64
|
+
for reader, inputs in manifest_edges(path, source, revision, inventory).items():
|
|
65
|
+
edges.setdefault(reader, set()).update(inputs)
|
|
66
|
+
return edges
|
selective_deps/models.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Language-independent declaration contracts, with no test-runner imports."""
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
6
|
+
|
|
7
|
+
CONTENTS_PREFIX = "@contents:"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def contents_node(path: str) -> str:
|
|
11
|
+
"""A file read as bytes; do not follow its import dependencies."""
|
|
12
|
+
return CONTENTS_PREFIX + path
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def file_of(node: str) -> str:
|
|
16
|
+
"""The repository-relative path represented by an import or content node."""
|
|
17
|
+
return node.removeprefix(CONTENTS_PREFIX)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class DependencyInputs(BaseModel):
|
|
21
|
+
model_config = ConfigDict(extra="forbid")
|
|
22
|
+
inputs: list[str]
|
|
23
|
+
reason: str = ""
|
|
24
|
+
kind: Literal["content", "import"] = "import"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ManifestDependencyRule(DependencyInputs):
|
|
28
|
+
inputs: list[str] = Field(min_length=1)
|
|
29
|
+
readers: list[str] | None = Field(default=None, min_length=1)
|
|
30
|
+
relative_to: Literal["manifest", "reader"] = "manifest"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class DependencyManifest(BaseModel):
|
|
34
|
+
model_config = ConfigDict(extra="forbid")
|
|
35
|
+
dependencies: list[ManifestDependencyRule]
|
selective_deps/parser.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""Reader-owned declarations: one path language and one YAML rule boundary."""
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
from pathlib import PurePosixPath
|
|
5
|
+
|
|
6
|
+
import yaml
|
|
7
|
+
|
|
8
|
+
from .models import DependencyManifest, contents_node
|
|
9
|
+
|
|
10
|
+
SIDECAR_SUFFIX = ".gv-dependency.yaml"
|
|
11
|
+
DIRECTORY_MANIFEST = ".gv-dependencies.yaml"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class DependencyDeclarationError(ValueError):
|
|
15
|
+
"""An authoring error which must never become a successful full fallback."""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def is_declaration(path: str) -> bool:
|
|
19
|
+
return path.endswith(SIDECAR_SUFFIX) or PurePosixPath(path).name == DIRECTORY_MANIFEST
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _path_pattern(pattern: str) -> re.Pattern[str]:
|
|
23
|
+
"""Compile our validated *, ?, ** language on every supported Python.
|
|
24
|
+
|
|
25
|
+
A slash is never matched by an ordinary wildcard; a whole ** segment can
|
|
26
|
+
consume zero or more directories. Hidden files are ordinary tracked inputs.
|
|
27
|
+
"""
|
|
28
|
+
segments = pattern.split("/")
|
|
29
|
+
expression = ""
|
|
30
|
+
for index, segment in enumerate(segments):
|
|
31
|
+
last = index == len(segments) - 1
|
|
32
|
+
if segment == "**":
|
|
33
|
+
expression += ".*" if last else "(?:[^/]+/)*"
|
|
34
|
+
else:
|
|
35
|
+
expression += "".join("[^/]*" if c == "*" else "[^/]" if c == "?" else re.escape(c) for c in segment)
|
|
36
|
+
if not last:
|
|
37
|
+
expression += "/"
|
|
38
|
+
return re.compile(expression, re.DOTALL)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def match_inputs(pattern: str, files: set[str], location: str, directory: str = ".") -> set[str]:
|
|
42
|
+
parts = pattern.split("/")
|
|
43
|
+
if (
|
|
44
|
+
any(part in {"", ".", ".."} for part in parts)
|
|
45
|
+
or any(char in pattern for char in "\\:[]{}")
|
|
46
|
+
or any("**" in part and part != "**" for part in parts)
|
|
47
|
+
):
|
|
48
|
+
raise DependencyDeclarationError(f"{location}: invalid repository-relative dependency pattern {pattern!r}")
|
|
49
|
+
rooted = pattern if directory == "." else f"{directory}/{pattern}"
|
|
50
|
+
if "*" not in rooted and "?" not in rooted:
|
|
51
|
+
targets = {rooted} if rooted in files else set()
|
|
52
|
+
else:
|
|
53
|
+
matcher = _path_pattern(rooted)
|
|
54
|
+
targets = {path for path in files if matcher.fullmatch(path)}
|
|
55
|
+
if not targets:
|
|
56
|
+
raise DependencyDeclarationError(f"{location}: test dependency {pattern!r} matches no tracked files")
|
|
57
|
+
return targets
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _check_yaml_keys(node: yaml.Node, seen: set[int]) -> None:
|
|
61
|
+
# Reject aliases and duplicate keys: neither may silently hide a rule.
|
|
62
|
+
if id(node) in seen:
|
|
63
|
+
raise DependencyDeclarationError("YAML aliases are not supported")
|
|
64
|
+
seen.add(id(node))
|
|
65
|
+
if isinstance(node, yaml.MappingNode):
|
|
66
|
+
keys: set[str] = set()
|
|
67
|
+
for key, value in node.value:
|
|
68
|
+
if not isinstance(key, yaml.ScalarNode) or key.tag != "tag:yaml.org,2002:str" or key.value in keys:
|
|
69
|
+
raise DependencyDeclarationError(f"line {key.start_mark.line + 1}: duplicate or non-string YAML key")
|
|
70
|
+
keys.add(key.value)
|
|
71
|
+
_check_yaml_keys(value, seen)
|
|
72
|
+
elif isinstance(node, yaml.SequenceNode):
|
|
73
|
+
for child in node.value:
|
|
74
|
+
_check_yaml_keys(child, seen)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def parse_manifest(source: bytes, location: str) -> DependencyManifest:
|
|
78
|
+
try:
|
|
79
|
+
node = yaml.compose(source.decode("utf-8-sig"), Loader=yaml.SafeLoader)
|
|
80
|
+
if node is not None:
|
|
81
|
+
_check_yaml_keys(node, set())
|
|
82
|
+
return DependencyManifest.model_validate(yaml.safe_load(source))
|
|
83
|
+
except (ValueError, yaml.YAMLError) as error:
|
|
84
|
+
raise DependencyDeclarationError(f"{location}: {error}") from error
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def manifest_edges(path: str, source: bytes, tree: str, files: set[str]) -> dict[str, set[str]]:
|
|
88
|
+
location = f"{tree}:{path}"
|
|
89
|
+
is_directory = PurePosixPath(path).name == DIRECTORY_MANIFEST
|
|
90
|
+
owner = path.removesuffix(SIDECAR_SUFFIX)
|
|
91
|
+
if not is_directory and (owner not in files or is_declaration(owner)):
|
|
92
|
+
raise DependencyDeclarationError(f"{location}: sidecar must belong to an existing non-sidecar tracked file")
|
|
93
|
+
manifest = parse_manifest(source, location)
|
|
94
|
+
directory = str(PurePosixPath(path).parent)
|
|
95
|
+
# A file sidecar already names its sole reader. Only directory manifests
|
|
96
|
+
# need to discover readers across the repository inventory.
|
|
97
|
+
reader_files = {file for file in files if not is_declaration(file)} if is_directory else set()
|
|
98
|
+
edges: dict[str, set[str]] = {} if is_directory else {owner: {path}}
|
|
99
|
+
for index, rule in enumerate(manifest.dependencies, 1):
|
|
100
|
+
rule_location = f"{location}:rule {index}"
|
|
101
|
+
if is_directory and not rule.readers:
|
|
102
|
+
raise DependencyDeclarationError(f"{rule_location}: directory rule requires readers")
|
|
103
|
+
if not is_directory and "readers" in rule.model_fields_set:
|
|
104
|
+
raise DependencyDeclarationError(f"{rule_location}: file sidecar must not specify readers")
|
|
105
|
+
readers = {owner}
|
|
106
|
+
if is_directory:
|
|
107
|
+
assert rule.readers is not None
|
|
108
|
+
readers = _expand(rule.readers, reader_files, directory, rule_location)
|
|
109
|
+
by_directory: dict[str, set[str]] = {}
|
|
110
|
+
for reader in sorted(readers):
|
|
111
|
+
# Resolve each reader's inputs separately: a sibling's matching files
|
|
112
|
+
# must neither widen this reader nor conceal its missing inputs.
|
|
113
|
+
input_directory = str(PurePosixPath(reader).parent) if rule.relative_to == "reader" else directory
|
|
114
|
+
if input_directory not in by_directory:
|
|
115
|
+
inputs = _expand(rule.inputs, files, input_directory, f"{rule_location}:reader {reader}")
|
|
116
|
+
by_directory[input_directory] = (
|
|
117
|
+
inputs if rule.kind == "import" else {contents_node(target) for target in inputs}
|
|
118
|
+
)
|
|
119
|
+
dependencies = by_directory[input_directory]
|
|
120
|
+
edges.setdefault(reader, set()).update(dependencies | {path})
|
|
121
|
+
edges[reader].discard(reader)
|
|
122
|
+
return edges
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def _expand(patterns: list[str], files: set[str], directory: str, location: str) -> set[str]:
|
|
126
|
+
targets: set[str] = set()
|
|
127
|
+
for pattern in patterns:
|
|
128
|
+
targets.update(
|
|
129
|
+
match_inputs(
|
|
130
|
+
pattern[2:] if pattern.startswith("//") else pattern,
|
|
131
|
+
files,
|
|
132
|
+
location,
|
|
133
|
+
"." if pattern.startswith("//") else directory,
|
|
134
|
+
)
|
|
135
|
+
)
|
|
136
|
+
return targets
|
selective_deps/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: selective-deps
|
|
3
|
+
Version: 1.7.1
|
|
4
|
+
Summary: Portable file dependency declarations for test selection and incremental tooling
|
|
5
|
+
Project-URL: Repository, https://github.com/gigaverse-app/pytest-selective
|
|
6
|
+
Project-URL: Documentation, https://pytest-selective.readthedocs.io/en/latest/docs/declarations/
|
|
7
|
+
Author: Gigaverse
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Python: >=3.11
|
|
11
|
+
Requires-Dist: pydantic<3,>=2.11
|
|
12
|
+
Requires-Dist: pyyaml<7,>=6
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# selective-deps
|
|
16
|
+
|
|
17
|
+
Declare file dependencies for test selection and incremental tooling in any language:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
pip install selective-deps
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
This package installs Pydantic and PyYAML. It does not depend on pytest or
|
|
24
|
+
pytest-selective, register plugins, inspect Python imports, open a graph cache,
|
|
25
|
+
or run Git. The full pytest-selective package uses this same implementation.
|
|
26
|
+
|
|
27
|
+
Place a sidecar next to the code that reads an input, for example
|
|
28
|
+
`web/catalog.ts.gv-dependency.yaml`:
|
|
29
|
+
|
|
30
|
+
```yaml
|
|
31
|
+
dependencies:
|
|
32
|
+
- inputs: ["//fixtures/catalog/*.json"]
|
|
33
|
+
kind: content
|
|
34
|
+
reason: The catalog loader reads these files at runtime.
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Use `.gv-dependencies.yaml` for several readers in one directory, adding
|
|
38
|
+
`readers: ["*.ts"]` to each rule. Paths are relative to the manifest directory;
|
|
39
|
+
`//` anchors a path at the repository root. `relative_to: reader` resolves
|
|
40
|
+
unanchored inputs relative to each reader instead. `*`, `?` and whole-segment
|
|
41
|
+
`**` patterns use the same validation as Python declarations.
|
|
42
|
+
|
|
43
|
+
The adapter supplies a complete tracked-file inventory and the declaration bytes
|
|
44
|
+
from one snapshot:
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from selective_deps import dependency_edges
|
|
48
|
+
|
|
49
|
+
files = {"web/catalog.ts", "web/catalog.ts.gv-dependency.yaml", "fixtures/catalog/demo.json"}
|
|
50
|
+
manifests = {
|
|
51
|
+
"web/catalog.ts.gv-dependency.yaml": b"dependencies:\n - inputs: ['//fixtures/catalog/*.json']\n kind: content\n"
|
|
52
|
+
}
|
|
53
|
+
edges = dependency_edges(manifests, files, revision="checked-out-commit")
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The result maps readers to dependencies. `kind: import` creates ordinary path
|
|
57
|
+
nodes whose transitive imports the language adapter should follow. `kind: content`
|
|
58
|
+
creates `@contents:<path>` leaf nodes: reading a source file as text does not
|
|
59
|
+
execute its imports. `contents_node(path)` and `file_of(node)` expose these
|
|
60
|
+
semantics without requiring a caller to reproduce the encoding.
|
|
61
|
+
|
|
62
|
+
Combine these edges with the native language graph before traversing it. A changed
|
|
63
|
+
file affects both its ordinary path node and its content node. Include base and
|
|
64
|
+
head graphs when handling removals. Manifest files themselves are dependencies
|
|
65
|
+
of their readers, so changing a declaration also selects those readers.
|
|
66
|
+
|
|
67
|
+
Malformed YAML, duplicate keys, aliases, missing owners, unmatched patterns and
|
|
68
|
+
an incomplete declaration inventory raise `DependencyDeclarationError`. Report
|
|
69
|
+
that error rather than treating a partial graph as proof to skip work. Declaration
|
|
70
|
+
parsing does not discover undeclared runtime reads or prove test completion.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
selective_deps/__init__.py,sha256=j_zEPFz-0I2nBfqjPxpXRgTdrifx2V68r6b_2VE2dNo,2118
|
|
2
|
+
selective_deps/models.py,sha256=IAuHmEmS3yF8qs7h-5G4XBenWI118z-BQjYqSq7lCCw,1022
|
|
3
|
+
selective_deps/parser.py,sha256=TnJNl1MDh20_3QbkUpc5PvcctDH0Xw2FRbMnNElhb5Y,6162
|
|
4
|
+
selective_deps/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
selective_deps-1.7.1.dist-info/METADATA,sha256=-rz3yJsWDhN0oKDk9x06DEfLzRIH1kmRVYWOwIDBCJY,2995
|
|
6
|
+
selective_deps-1.7.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
7
|
+
selective_deps-1.7.1.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
8
|
+
selective_deps-1.7.1.dist-info/RECORD,,
|
|
@@ -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 [yyyy] [name of copyright owner]
|
|
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.
|