nacos-sdk-rust-binding-py 0.4.0__cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.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,5 @@
1
+ from .nacos_sdk_rust_binding_py import *
2
+
3
+ __doc__ = nacos_sdk_rust_binding_py.__doc__
4
+ if hasattr(nacos_sdk_rust_binding_py, "__all__"):
5
+ __all__ = nacos_sdk_rust_binding_py.__all__
@@ -0,0 +1,239 @@
1
+ from typing import Callable, Dict, List, NoReturn, Optional
2
+
3
+ class ClientOptions:
4
+ def __init__(
5
+ self,
6
+ server_addr: str,
7
+ namespace: str,
8
+ app_name: Optional[str],
9
+ username: Optional[str],
10
+ password: Optional[str],
11
+ naming_push_empty_protection: Optional[bool],
12
+ naming_load_cache_at_start: Optional[bool],
13
+ ) -> None: ...
14
+
15
+ class NacosConfigResponse:
16
+ @property
17
+ def namespace(self) -> str: ...
18
+ @property
19
+ def data_id(self) -> str: ...
20
+ @property
21
+ def group(self) -> str: ...
22
+ @property
23
+ def content(self) -> str: ...
24
+ @property
25
+ def content_type(self) -> str: ...
26
+ @property
27
+ def md5(self) -> str: ...
28
+
29
+ class NacosConfigClient:
30
+ def __init__(self, client_options: ClientOptions) -> None: ...
31
+ def get_config(self, data_id: str, group: str) -> str:
32
+ """Get config's content. If it fails, pay attention to err"""
33
+
34
+ ...
35
+ def get_config_resp(self, data_id: str, group: str) -> NacosConfigResponse:
36
+ """Get NacosConfigResponse. If it fails, pay attention to err"""
37
+
38
+ ...
39
+ def publish_config(self, data_id: str, group: str, content: str) -> bool:
40
+ """Publish config. If it fails, pay attention to err"""
41
+
42
+ ...
43
+ def remove_config(self, data_id: str, group: str) -> bool:
44
+ """Remove config. If it fails, pay attention to err"""
45
+
46
+ ...
47
+ def add_listener(
48
+ self,
49
+ data_id: str,
50
+ group: str,
51
+ listener: Callable[[NacosConfigResponse], NoReturn],
52
+ ):
53
+ """Add NacosConfigChangeListener callback func, which listen the config change. If it fails, pay attention to err"""
54
+
55
+ ...
56
+
57
+ class AsyncNacosConfigClient:
58
+ def __init__(self, client_options: ClientOptions) -> None: ...
59
+ async def get_config(self, data_id: str, group: str) -> str:
60
+ """Get config's content. If it fails, pay attention to err"""
61
+
62
+ ...
63
+ async def get_config_resp(self, data_id: str, group: str) -> NacosConfigResponse:
64
+ """Get NacosConfigResponse. If it fails, pay attention to err"""
65
+
66
+ ...
67
+ async def publish_config(self, data_id: str, group: str, content: str) -> bool:
68
+ """Publish config. If it fails, pay attention to err"""
69
+
70
+ ...
71
+ async def remove_config(self, data_id: str, group: str) -> bool:
72
+ """Remove config. If it fails, pay attention to err"""
73
+
74
+ ...
75
+ async def add_listener(
76
+ self,
77
+ data_id: str,
78
+ group: str,
79
+ listener: Callable[[NacosConfigResponse], NoReturn],
80
+ ):
81
+ """Add NacosConfigChangeListener callback func, which listen the config change. If it fails, pay attention to err"""
82
+
83
+ ...
84
+
85
+ class NacosServiceInstance:
86
+ def __init__(
87
+ self,
88
+ ip: str,
89
+ port: int,
90
+ weight: Optional[float],
91
+ healthy: Optional[bool],
92
+ enabled: Optional[bool],
93
+ ephemeral: Optional[bool],
94
+ cluster_name: Optional[str],
95
+ service_name: Optional[str],
96
+ metadata: Optional[Dict[str, str]],
97
+ ) -> None: ...
98
+
99
+ class NacosNamingClient:
100
+ def __init__(self, client_options: ClientOptions) -> None: ...
101
+ def register_instance(
102
+ self, service_name: str, group: str, service_instance: NacosServiceInstance
103
+ ):
104
+ """Register instance. If it fails, pay attention to err"""
105
+
106
+ ...
107
+
108
+ def deregister_instance(
109
+ self, service_name: str, group: str, service_instance: NacosServiceInstance
110
+ ):
111
+ """Deregister instance. If it fails, pay attention to err"""
112
+
113
+ ...
114
+
115
+ def batch_register_instance(
116
+ self,
117
+ service_name: str,
118
+ group: str,
119
+ service_instances: List[NacosServiceInstance],
120
+ ):
121
+ """Batch register instance, improve interaction efficiency. If it fails, pay attention to err"""
122
+
123
+ ...
124
+
125
+ def get_all_instances(
126
+ self,
127
+ service_name: str,
128
+ group: str,
129
+ clusters: Optional[List[str]],
130
+ subscribe: Optional[bool],
131
+ ) -> List[NacosServiceInstance]:
132
+ """Get all instances by service and group. default cluster=[], subscribe=true. If it fails, pay attention to err"""
133
+
134
+ ...
135
+
136
+ def select_instances(
137
+ self,
138
+ service_name: str,
139
+ group: str,
140
+ clusters: Optional[List[str]],
141
+ subscribe: Optional[bool],
142
+ healthy: Optional[bool],
143
+ ) -> List[NacosServiceInstance]:
144
+ """Select instances whether healthy or not. default cluster=[], subscribe=true, healthy=true. If it fails, pay attention to err"""
145
+
146
+ ...
147
+
148
+ def select_one_healthy_instance(
149
+ self,
150
+ service_name: str,
151
+ group: str,
152
+ clusters: Optional[List[str]],
153
+ subscribe: Optional[bool],
154
+ ) -> NacosServiceInstance:
155
+ """Select one healthy instance. default cluster=[], subscribe=true. If it fails, pay attention to err"""
156
+
157
+ ...
158
+
159
+ def subscribe(
160
+ self,
161
+ service_name: str,
162
+ group: str,
163
+ clusters: Optional[List[str]],
164
+ listener: Callable[[NacosConfigResponse], NoReturn],
165
+ ) -> NacosServiceInstance:
166
+ """Add NacosNamingEventListener callback func, which listen the instance change. If it fails, pay attention to err"""
167
+
168
+ ...
169
+
170
+ class AsyncNacosNamingClient:
171
+ def __init__(self, client_options: ClientOptions) -> None: ...
172
+ async def register_instance(
173
+ self, service_name: str, group: str, service_instance: NacosServiceInstance
174
+ ):
175
+ """Register instance. If it fails, pay attention to err"""
176
+
177
+ ...
178
+
179
+ async def deregister_instance(
180
+ self, service_name: str, group: str, service_instance: NacosServiceInstance
181
+ ):
182
+ """Deregister instance. If it fails, pay attention to err"""
183
+
184
+ ...
185
+
186
+ async def batch_register_instance(
187
+ self,
188
+ service_name: str,
189
+ group: str,
190
+ service_instances: List[NacosServiceInstance],
191
+ ):
192
+ """Batch register instance, improve interaction efficiency. If it fails, pay attention to err"""
193
+
194
+ ...
195
+
196
+ async def get_all_instances(
197
+ self,
198
+ service_name: str,
199
+ group: str,
200
+ clusters: Optional[List[str]],
201
+ subscribe: Optional[bool],
202
+ ) -> List[NacosServiceInstance]:
203
+ """Get all instances by service and group. default cluster=[], subscribe=true. If it fails, pay attention to err"""
204
+
205
+ ...
206
+
207
+ async def select_instances(
208
+ self,
209
+ service_name: str,
210
+ group: str,
211
+ clusters: Optional[List[str]],
212
+ subscribe: Optional[bool],
213
+ healthy: Optional[bool],
214
+ ) -> List[NacosServiceInstance]:
215
+ """Select instances whether healthy or not. default cluster=[], subscribe=true, healthy=true. If it fails, pay attention to err"""
216
+
217
+ ...
218
+
219
+ async def select_one_healthy_instance(
220
+ self,
221
+ service_name: str,
222
+ group: str,
223
+ clusters: Optional[List[str]],
224
+ subscribe: Optional[bool],
225
+ ) -> NacosServiceInstance:
226
+ """Select one healthy instance. default cluster=[], subscribe=true. If it fails, pay attention to err"""
227
+
228
+ ...
229
+
230
+ async def subscribe(
231
+ self,
232
+ service_name: str,
233
+ group: str,
234
+ clusters: Optional[List[str]],
235
+ listener: Callable[[NacosConfigResponse], NoReturn],
236
+ ) -> NacosServiceInstance:
237
+ """Add NacosNamingEventListener callback func, which listen the instance change. If it fails, pay attention to err"""
238
+
239
+ ...
File without changes
@@ -0,0 +1,266 @@
1
+ Metadata-Version: 2.3
2
+ Name: nacos-sdk-rust-binding-py
3
+ Version: 0.4.0
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: Programming Language :: Python :: Implementation :: CPython
6
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
7
+ Requires-Dist: pdoc ; extra == 'docs'
8
+ Requires-Dist: behave ; extra == 'test'
9
+ Provides-Extra: docs
10
+ Provides-Extra: test
11
+ License-File: LICENSE
12
+ Summary: nacos-sdk-rust binding for Python.
13
+ Keywords: nacos,ffi,pyo3,binding,python
14
+ Author: CheirshCai <785427346@qq.com>
15
+ Author-email: CheirshCai <785427346@qq.com>
16
+ License: Apache-2.0
17
+ Requires-Python: >=3.7
18
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
19
+ Project-URL: Documentation, https://github.com/opc-source/nacos-sdk-rust-binding-py.git
20
+ Project-URL: Homepage, https://github.com/opc-source/nacos-sdk-rust-binding-py.git
21
+ Project-URL: Repository, https://github.com/opc-source/nacos-sdk-rust-binding-py.git
22
+
23
+ # nacos-sdk-rust-binding-py
24
+ nacos-sdk-rust binding for Python with PyO3.
25
+
26
+ Tip: nacos-sdk-python 仓库暂未提供 2.x gRPC 交互模式,为了能升级它,故而通过 ffi 方式调用 nacos-sdk-rust
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ pip install nacos-sdk-rust-binding-py
32
+ ```
33
+
34
+ - project package see https://pypi.org/project/nacos-sdk-rust-binding-py
35
+
36
+ ## Usage
37
+
38
+ **使用样例请看仓库内的 examples 目录**
39
+ - Block api: [examples/naming.py](examples/naming.py) / [examples/config.py](examples/config.py)
40
+ - Async api: [examples/async_naming.py](examples/async_naming.py) / [examples/async_config.py](examples/async_config.py)
41
+
42
+ **其它设置**
43
+
44
+ 环境变量 `NACOS_CLIENT_LOGGER_LEVEL=INFO` 可设置日志打印级别,默认 INFO
45
+ - 客户端日志请在目录 `$HOME/logs/nacos/` 查看
46
+
47
+ 环境变量 `NACOS_CLIENT_COMMON_THREAD_CORES=4` 可设置客户端核心线程数,默认是 CPU 数目 1
48
+
49
+ 环境变量 `ENV_NACOS_CLIENT_NAMING_PUSH_EMPTY_PROTECTION=false` 可关闭 Naming 防推空保护,默认 true
50
+
51
+ 更多环境变量请看 `nacos-sdk-rust` 的[文档说明](https://github.com/nacos-group/nacos-sdk-rust)
52
+
53
+ ### Definition of ClientOptions
54
+
55
+ ```python
56
+ class ClientOptions:
57
+ # Server Addr, e.g. address:port[,address:port],...]
58
+ #[pyo3(set, get)]
59
+ server_addr: String,
60
+ # Namespace/Tenant
61
+ #[pyo3(set, get)]
62
+ namespace: String,
63
+ # AppName
64
+ #[pyo3(set, get)]
65
+ app_name: Option<String>,
66
+ # Username for Auth
67
+ #[pyo3(set, get)]
68
+ username: Option<String>,
69
+ # Password for Auth
70
+ #[pyo3(set, get)]
71
+ password: Option<String>,
72
+ # naming push_empty_protection, default true
73
+ #[pyo3(set, get)]
74
+ naming_push_empty_protection: Option<bool>,
75
+ # naming load_cache_at_start, default false
76
+ #[pyo3(set, get)]
77
+ naming_load_cache_at_start: Option<bool>,
78
+
79
+ # Init
80
+ def __init__(self, server_addr, namespace, app_name, username, password):
81
+ self.server_addr = server_addr
82
+ self.namespace = namespace
83
+ self.app_name = app_name
84
+ self.username = username
85
+ self.password = password
86
+
87
+ ```
88
+
89
+ ### Definition of Config
90
+
91
+ ```python
92
+ class NacosConfigResponse:
93
+ # Namespace/Tenant
94
+ # [pyo3(get)]
95
+ namespace: String,
96
+ # DataId
97
+ # [pyo3(get)]
98
+ data_id: String,
99
+ # Group
100
+ # [pyo3(get)]
101
+ group: String,
102
+ # Content
103
+ # [pyo3(get)]
104
+ content: String,
105
+ # Content's Type; e.g. json,properties,xml,html,text,yaml
106
+ # [pyo3(get)]
107
+ content_type: String,
108
+ # Content's md5
109
+ # [pyo3(get)]
110
+ md5: String,
111
+
112
+
113
+ class NacosConfigClient:
114
+ # Init. If it fails, pay attention to err
115
+ def __init__(self, client_options: ClientOptions):
116
+ # inner logic xxx
117
+ pass
118
+
119
+ # Get config's content. If it fails, pay attention to err
120
+ def get_config(self, data_id: String, group: String) -> String:
121
+ pass
122
+
123
+ # Get NacosConfigResponse. If it fails, pay attention to err
124
+ def get_config_resp(self, data_id: String, group: String) -> NacosConfigResponse:
125
+ pass
126
+
127
+ # Publish config. If it fails, pay attention to err
128
+ def publish_config(self, data_id: String, group: String, content: String) -> bool:
129
+ pass
130
+
131
+ # Remove config. If it fails, pay attention to err
132
+ def remove_config(self, data_id: String, group: String) -> bool:
133
+ pass
134
+
135
+ # Add NacosConfigChangeListener callback func, which listen the config change. If it fails, pay attention to err
136
+ def add_listener(self, data_id: String, group: String, listener: py_function):
137
+ pass
138
+
139
+
140
+ ```
141
+
142
+ ### Definition of Naming
143
+
144
+ ```python
145
+ class NacosServiceInstance:
146
+ # Instance Id
147
+ #[pyo3(set, get)]
148
+ instance_id: Option<String>,
149
+ # Ip
150
+ #[pyo3(set, get)]
151
+ ip: String,
152
+ # Port
153
+ #[pyo3(set, get)]
154
+ port: i32,
155
+ # Weight, default 1.0
156
+ #[pyo3(set, get)]
157
+ weight: Option<f64>,
158
+ # Healthy or not, default true
159
+ #[pyo3(set, get)]
160
+ healthy: Option<bool>,
161
+ # Enabled ot not, default true
162
+ #[pyo3(set, get)]
163
+ enabled: Option<bool>,
164
+ # Ephemeral or not, default true
165
+ #[pyo3(set, get)]
166
+ ephemeral: Option<bool>,
167
+ # Cluster Name, default 'DEFAULT'
168
+ #[pyo3(set, get)]
169
+ cluster_name: Option<String>,
170
+ # Service Name
171
+ #[pyo3(set, get)]
172
+ service_name: Option<String>,
173
+ # Metadata, default '{}'
174
+ #[pyo3(set, get)]
175
+ metadata: Option<std::collections::HashMap<String, String>>,
176
+
177
+ # Init
178
+ def __init__(self, ip, port, weight, healthy, enabled, ephemeral, cluster_name, service_name, metadata):
179
+ # inner logic xxx
180
+ pass
181
+
182
+
183
+ class NacosNamingClient:
184
+ # Init. If it fails, pay attention to err
185
+ def __init__(self, client_options: ClientOptions):
186
+ # inner logic xxx
187
+ pass
188
+
189
+ # Register instance. If it fails, pay attention to err
190
+ def register_instance(self, service_name: String, group: String, service_instance: NacosServiceInstance):
191
+ pass
192
+
193
+ # Deregister instance. If it fails, pay attention to err
194
+ def deregister_instance(self, service_name: String, group: String, service_instance: NacosServiceInstance):
195
+ pass
196
+
197
+ # Batch register instance, improve interaction efficiency. If it fails, pay attention to err
198
+ def batch_register_instance(self, service_name: String, group: String, service_instances: [NacosServiceInstance]):
199
+ pass
200
+
201
+ # Get all instances by service and group. default cluster=[], subscribe=true. If it fails, pay attention to err
202
+ def get_all_instances(self, service_name: String, group: String, clusters: Option<[String]>, subscribe: Option<bool>) -> [NacosServiceInstance]:
203
+ pass
204
+
205
+ # Select instances whether healthy or not. default cluster=[], subscribe=true, healthy=true. If it fails, pay attention to err
206
+ def select_instances(self, service_name: String, group: String, clusters: Option<[String]>, subscribe: Option<bool>, healthy: Option<bool>) -> [NacosServiceInstance]:
207
+ pass
208
+
209
+ # Select one healthy instance. default cluster=[], subscribe=true. If it fails, pay attention to err
210
+ def select_one_healthy_instance(self, service_name: String, group: String, clusters: Option<[String]>, subscribe: Option<bool>) -> NacosServiceInstance:
211
+ pass
212
+
213
+ # Add NacosNamingEventListener callback func, which listen the instance change. If it fails, pay attention to err
214
+ def subscribe(self, service_name: String, group: String, clusters: Option<[String]>, listener: py_function) -> NacosServiceInstance:
215
+ pass
216
+
217
+
218
+ ```
219
+
220
+ ## Development
221
+
222
+ Setup virtualenv:
223
+
224
+ ```shell
225
+ python -m venv venv
226
+ ```
227
+
228
+ Activate venv:
229
+
230
+ ```shell
231
+ source venv/bin/activate
232
+ ````
233
+
234
+ Install `maturin`:
235
+
236
+ ```shell
237
+ pip install maturin[patchelf]
238
+ ```
239
+
240
+ Build bindings:
241
+
242
+ ```shell
243
+ maturin develop
244
+ ```
245
+
246
+ Run some tests:
247
+
248
+ ```shell
249
+ maturin develop -E test
250
+ behave tests
251
+ ```
252
+
253
+ Build API docs:
254
+
255
+ ```shell
256
+ maturin develop -E docs
257
+ pdoc nacos-sdk-rust-binding-py
258
+ ```
259
+
260
+ # License
261
+ [Apache License Version 2.0](LICENSE)
262
+
263
+ # Acknowledgement
264
+ - binding for Python with [PyO3](https://github.com/PyO3/pyo3.git)
265
+ - binding the [nacos-sdk-rust](https://github.com/nacos-group/nacos-sdk-rust.git)
266
+
@@ -0,0 +1,8 @@
1
+ nacos_sdk_rust_binding_py-0.4.0.dist-info/METADATA,sha256=9AsYHZv5bPYzU82FnpRaJ6MCyusXy19T5f-LiAxvm80,7971
2
+ nacos_sdk_rust_binding_py-0.4.0.dist-info/WHEEL,sha256=QgkKv7RLYX1U6hof_NuG3KpbQ0aCazoXtYNuOfzt-fs,123
3
+ nacos_sdk_rust_binding_py-0.4.0.dist-info/license_files/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
4
+ nacos_sdk_rust_binding_py/__init__.py,sha256=KQBZgI2Tvj-KFIC7ObI-xwCQrmcYncTxJgANsMNd5UQ,183
5
+ nacos_sdk_rust_binding_py/__init__.pyi,sha256=8IhLoDl7D3WWoWraHuntMoO5aIfceA3Ir4YktvPn_Y4,7455
6
+ nacos_sdk_rust_binding_py/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ nacos_sdk_rust_binding_py/nacos_sdk_rust_binding_py.cpython-39-i386-linux-gnu.so,sha256=EQX8s76rgHicWb7qFTjdDtGQcTgM23jHaK3IPzboGpw,14092204
8
+ nacos_sdk_rust_binding_py-0.4.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.5.1)
3
+ Root-Is-Purelib: false
4
+ Tag: cp39-cp39-manylinux_2_17_i686.manylinux2014_i686
@@ -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.