python3-commons 0.5.37__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.

Potentially problematic release.


This version of python3-commons might be problematic. Click here for more details.

@@ -0,0 +1,7 @@
1
+ import importlib.metadata
2
+
3
+ try:
4
+ dist_name = __name__
5
+ __version__ = importlib.metadata.version(dist_name)
6
+ except importlib.metadata.PackageNotFoundError:
7
+ __version__ = 'unknown'
@@ -0,0 +1,180 @@
1
+ import asyncio
2
+ import io
3
+ import logging
4
+ import tarfile
5
+ from bz2 import BZ2Compressor
6
+ from datetime import datetime, timedelta, UTC
7
+ from typing import Generator, Iterable
8
+ from uuid import uuid4
9
+
10
+ from lxml import etree
11
+ from minio import S3Error
12
+ from zeep.plugins import Plugin
13
+ from zeep.wsdl.definitions import AbstractOperation
14
+
15
+ from python3_commons import object_storage
16
+ from python3_commons.conf import S3Settings, s3_settings
17
+ from python3_commons.object_storage import ObjectStorage
18
+
19
+ logger = logging.getLogger(__name__)
20
+
21
+
22
+ class GeneratedStream(io.BytesIO):
23
+ def __init__(self, generator: Generator[bytes, None, None], *args, **kwargs):
24
+ super().__init__(*args, **kwargs)
25
+ self.generator = generator
26
+
27
+ def read(self, size: int = -1):
28
+ if size < 0:
29
+ while True:
30
+ try:
31
+ chunk = next(self.generator)
32
+ except StopIteration:
33
+ break
34
+ else:
35
+ self.write(chunk)
36
+ else:
37
+ total_written_size = 0
38
+
39
+ while total_written_size < size:
40
+ try:
41
+ chunk = next(self.generator)
42
+ except StopIteration:
43
+ break
44
+ else:
45
+ self.write(chunk)
46
+ total_written_size += len(chunk)
47
+
48
+ self.seek(0)
49
+
50
+ if chunk := super().read(size):
51
+ pos = self.tell()
52
+
53
+ buf = self.getbuffer()
54
+ unread_data_size = len(buf) - pos
55
+
56
+ if unread_data_size > 0:
57
+ buf[:unread_data_size] = buf[pos:pos+unread_data_size]
58
+
59
+ del buf
60
+
61
+ self.seek(0)
62
+ self.truncate(unread_data_size)
63
+
64
+ return chunk
65
+
66
+ def readable(self):
67
+ return True
68
+
69
+
70
+ def generate_archive(objects: Iterable[tuple[str, datetime, bytes]],
71
+ chunk_size: int = 4096) -> Generator[bytes, None, None]:
72
+ buffer = io.BytesIO()
73
+
74
+ with tarfile.open(fileobj=buffer, mode='w') as archive:
75
+ for name, last_modified, content in objects:
76
+ logger.info(f'Adding {name} to archive')
77
+ info = tarfile.TarInfo(name)
78
+ info.size = len(content)
79
+ info.mtime = last_modified.timestamp()
80
+ archive.addfile(info, io.BytesIO(content))
81
+
82
+ buffer.seek(0)
83
+
84
+ while True:
85
+ chunk = buffer.read(chunk_size)
86
+
87
+ if not chunk:
88
+ break
89
+
90
+ yield chunk
91
+
92
+ buffer.seek(0)
93
+ buffer.truncate(0)
94
+
95
+
96
+ def generate_bzip2(chunks: Generator[bytes, None, None]) -> Generator[bytes, None, None]:
97
+ compressor = BZ2Compressor()
98
+
99
+ for chunk in chunks:
100
+ if compressed_chunk := compressor.compress(chunk):
101
+ yield compressed_chunk
102
+
103
+ if compressed_chunk := compressor.flush():
104
+ yield compressed_chunk
105
+
106
+
107
+ def write_audit_data_sync(settings: S3Settings, key: str, data: bytes):
108
+ if settings.s3_secret_access_key:
109
+ try:
110
+ client = ObjectStorage(settings).get_client()
111
+ absolute_path = object_storage.get_absolute_path(f'audit/{key}')
112
+
113
+ client.put_object(settings.s3_bucket, absolute_path, io.BytesIO(data), len(data))
114
+ except S3Error as e:
115
+ logger.error(f'Failed storing object in storage: {e}')
116
+ else:
117
+ logger.debug(f'Stored object in storage: {key}')
118
+ else:
119
+ logger.debug(f'S3 is not configured, not storing object in storage: {key}')
120
+
121
+
122
+ async def write_audit_data(settings: S3Settings, key: str, data: bytes):
123
+ write_audit_data_sync(settings, key, data)
124
+
125
+
126
+ async def archive_audit_data(root_path: str = 'audit'):
127
+ now = datetime.now(tz=UTC) - timedelta(days=1)
128
+ year = now.year
129
+ month = now.month
130
+ day = now.day
131
+ bucket_name = s3_settings.s3_bucket
132
+ date_path = object_storage.get_absolute_path(f'{root_path}/{year}/{month:02}/{day:02}')
133
+
134
+ if objects := object_storage.get_objects(bucket_name, date_path, recursive=True):
135
+ logger.info(f'Compacting files in: {date_path}')
136
+
137
+ generator = generate_archive(objects, chunk_size=5*1024*1024)
138
+ bzip2_generator = generate_bzip2(generator)
139
+ archive_stream = GeneratedStream(bzip2_generator)
140
+
141
+ archive_path = object_storage.get_absolute_path(f'audit/.archive/{year}_{month:02}_{day:02}.tar.bz2')
142
+ object_storage.put_object(bucket_name, archive_path, archive_stream, -1, part_size=5*1024*1024)
143
+
144
+ if errors := object_storage.remove_objects(bucket_name, date_path):
145
+ for error in errors:
146
+ logger.error(f'Failed to delete object in {bucket_name=}: {error}')
147
+
148
+
149
+ class ZeepAuditPlugin(Plugin):
150
+ def __init__(self, audit_name: str = 'zeep'):
151
+ super().__init__()
152
+ self.audit_name = audit_name
153
+
154
+ def store_audit_in_s3(self, envelope, operation: AbstractOperation, direction: str):
155
+ xml = etree.tostring(envelope, encoding='UTF-8', pretty_print=True)
156
+ now = datetime.now(tz=UTC)
157
+ date_path = now.strftime('%Y/%m/%d')
158
+ timestamp = now.strftime('%H%M%S')
159
+ path = f'{date_path}/{self.audit_name}/{operation.name}/{timestamp}_{str(uuid4())[-12:]}_{direction}.xml'
160
+ coro = write_audit_data(s3_settings, path, xml)
161
+
162
+ try:
163
+ loop = asyncio.get_running_loop()
164
+ except RuntimeError:
165
+ loop = None
166
+
167
+ if loop and loop.is_running():
168
+ loop.create_task(coro)
169
+ else:
170
+ asyncio.run(coro)
171
+
172
+ def ingress(self, envelope, http_headers, operation: AbstractOperation):
173
+ self.store_audit_in_s3(envelope, operation, 'ingress')
174
+
175
+ return envelope, http_headers
176
+
177
+ def egress(self, envelope, http_headers, operation: AbstractOperation, binding_options):
178
+ self.store_audit_in_s3(envelope, operation, 'egress')
179
+
180
+ return envelope, http_headers
@@ -0,0 +1,23 @@
1
+ from pydantic import SecretStr
2
+ from pydantic_settings import BaseSettings
3
+
4
+
5
+ class CommonSettings(BaseSettings):
6
+ logging_level: str = 'INFO'
7
+ logging_format: str = '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
8
+ logging_formatter: str = 'default'
9
+
10
+
11
+ class S3Settings(BaseSettings):
12
+ s3_endpoint_url: str | None = None
13
+ s3_region_name: str | None = None
14
+ s3_access_key_id: SecretStr = ''
15
+ s3_secret_access_key: SecretStr = ''
16
+ s3_secure: bool = True
17
+ s3_bucket: str | None = None
18
+ s3_bucket_root: str | None = None
19
+ s3_cert_verify: bool = True
20
+
21
+
22
+ settings = CommonSettings()
23
+ s3_settings = S3Settings()
python3_commons/db.py ADDED
@@ -0,0 +1,28 @@
1
+ import asyncio
2
+ import logging
3
+
4
+ from asyncpg import CannotConnectNowError
5
+ from pydantic import PostgresDsn
6
+
7
+ logger = logging.getLogger(__name__)
8
+
9
+
10
+ async def connect_to_db(database, dsn: PostgresDsn):
11
+ logger.info('Waiting for services')
12
+ logger.debug(f'DB_DSN: {dsn}')
13
+ timeout = 0.001
14
+ total_timeout = 0
15
+
16
+ for i in range(15):
17
+ try:
18
+ await database.connect()
19
+ except (ConnectionRefusedError, CannotConnectNowError):
20
+ timeout *= 2
21
+ await asyncio.sleep(timeout)
22
+ total_timeout += timeout
23
+ else:
24
+ break
25
+ else:
26
+ msg = f'Unable to connect database for {int(total_timeout)}s'
27
+ logger.error(msg)
28
+ raise ConnectionRefusedError(msg)
python3_commons/fs.py ADDED
@@ -0,0 +1,10 @@
1
+ from pathlib import Path
2
+ from typing import Generator
3
+
4
+
5
+ def iter_files(root: Path, recursive: bool = True) -> Generator[Path, None, None]:
6
+ for item in root.iterdir():
7
+ if item.is_file():
8
+ yield item
9
+ elif item.is_dir() and recursive and not item.name.startswith('.'):
10
+ yield from iter_files(item)
@@ -0,0 +1,87 @@
1
+ import datetime
2
+ import logging
3
+ import shlex
4
+ import threading
5
+
6
+ from decimal import Decimal, ROUND_HALF_UP
7
+ from typing import Mapping
8
+
9
+ logger = logging.getLogger(__name__)
10
+
11
+
12
+ class SingletonMeta(type):
13
+ """
14
+ A metaclass that creates a Singleton base class when called.
15
+ """
16
+ _instances = {}
17
+ _lock = threading.Lock()
18
+
19
+ def __call__(cls, *args, **kwargs):
20
+ try:
21
+ return cls._instances[cls]
22
+ except KeyError:
23
+ with cls._lock:
24
+ try:
25
+ return cls._instances[cls]
26
+ except KeyError:
27
+ instance = super(SingletonMeta, cls).__call__(*args, **kwargs)
28
+ cls._instances[cls] = instance
29
+
30
+ return instance
31
+
32
+
33
+ def date_from_string(string: str, fmt: str = '%d.%m.%Y') -> datetime.date:
34
+ try:
35
+ return datetime.datetime.strptime(string, fmt).date()
36
+ except ValueError:
37
+ return datetime.date.fromisoformat(string)
38
+
39
+
40
+ def datetime_from_string(string: str) -> datetime.datetime:
41
+ try:
42
+ return datetime.datetime.strptime(string, '%d.%m.%Y %H:%M:%S')
43
+ except ValueError:
44
+ return datetime.datetime.fromisoformat(string)
45
+
46
+
47
+ def date_range(start_date, end_date):
48
+ for n in range(int((end_date - start_date).days + 1)):
49
+ yield start_date + datetime.timedelta(days=n)
50
+
51
+
52
+ def tries(times):
53
+ def func_wrapper(f):
54
+ async def wrapper(*args, **kwargs):
55
+ for time in range(times if times > 0 else 1):
56
+ # noinspection PyBroadException
57
+ try:
58
+ return await f(*args, **kwargs)
59
+ except Exception as exc:
60
+ if time >= times:
61
+ raise exc
62
+
63
+ return wrapper
64
+
65
+ return func_wrapper
66
+
67
+
68
+ def round_decimal(value: Decimal, decimal_places=2, rounding_mode=ROUND_HALF_UP) -> Decimal:
69
+ try:
70
+ return value.quantize(Decimal(10) ** -decimal_places, rounding=rounding_mode)
71
+ except AttributeError:
72
+ return value
73
+
74
+
75
+ def request_to_curl(url: str, method: str, headers: Mapping, body: bytes | None = None) -> str:
76
+ curl_cmd = ['curl', '-i', '-X', method, shlex.quote(url)]
77
+
78
+ for key, value in headers.items():
79
+ header_line = f'{key}: {value}'
80
+ curl_cmd.append('-H')
81
+ curl_cmd.append(shlex.quote(header_line))
82
+
83
+ if body is not None:
84
+ curl_cmd.append('--data')
85
+ curl_cmd.append(shlex.quote(body.decode('utf-8')))
86
+
87
+ return ' '.join(curl_cmd)
File without changes
@@ -0,0 +1,10 @@
1
+ import logging
2
+
3
+
4
+ def filter_maker(level):
5
+ level = getattr(logging, level)
6
+
7
+ def record_filter(record):
8
+ return record.levelno <= level
9
+
10
+ return record_filter
@@ -0,0 +1,26 @@
1
+ import json
2
+ import logging
3
+ import traceback
4
+ from contextvars import ContextVar
5
+
6
+ from python3_commons.serializers.json import CustomJSONEncoder
7
+
8
+
9
+ correlation_id: ContextVar[str | None] = ContextVar('correlation_id', default=None)
10
+
11
+
12
+ class JSONFormatter(logging.Formatter):
13
+ @staticmethod
14
+ def format_exception(exc_info):
15
+ return ''.join(traceback.format_exception(*exc_info))
16
+
17
+ def format(self, record):
18
+ if corr_id := correlation_id.get():
19
+ record.correlation_id = corr_id
20
+
21
+ if record.exc_info:
22
+ record.exc_text = self.format_exception(record.exc_info)
23
+ else:
24
+ record.exc_text = None
25
+
26
+ return json.dumps(record.__dict__, cls=CustomJSONEncoder)
@@ -0,0 +1,125 @@
1
+ import io
2
+ import logging
3
+ from contextlib import contextmanager
4
+ from datetime import datetime
5
+ from typing import Generator, Iterable
6
+
7
+ from minio import Minio
8
+ from minio.datatypes import Object
9
+ from minio.deleteobjects import DeleteObject, DeleteError
10
+
11
+ from python3_commons.conf import s3_settings, S3Settings
12
+ from python3_commons.helpers import SingletonMeta
13
+
14
+ logger = logging.getLogger(__name__)
15
+
16
+
17
+ class ObjectStorage(metaclass=SingletonMeta):
18
+ def __init__(self, settings: S3Settings):
19
+ if not s3_settings.s3_endpoint_url:
20
+ raise ValueError('s3_settings.s3_endpoint_url must be set')
21
+
22
+ self._client = Minio(
23
+ settings.s3_endpoint_url,
24
+ region=settings.s3_region_name,
25
+ access_key=settings.s3_access_key_id.get_secret_value(),
26
+ secret_key=settings.s3_secret_access_key.get_secret_value(),
27
+ secure=settings.s3_secure,
28
+ cert_check=settings.s3_cert_verify
29
+ )
30
+
31
+ def get_client(self) -> Minio:
32
+ return self._client
33
+
34
+
35
+ def get_absolute_path(path: str) -> str:
36
+ if path.startswith('/'):
37
+ path = path[1:]
38
+
39
+ if bucket_root := s3_settings.s3_bucket_root:
40
+ path = f'{bucket_root[:1] if bucket_root.startswith('/') else bucket_root}/{path}'
41
+
42
+ return path
43
+
44
+
45
+ def put_object(bucket_name: str, path: str, data: io.BytesIO, length: int, part_size: int = 0) -> str:
46
+ if s3_client := ObjectStorage(s3_settings).get_client():
47
+ result = s3_client.put_object(bucket_name, path, data, length, part_size=part_size)
48
+
49
+ logger.debug(f'Stored object into object storage: {bucket_name}:{path}')
50
+
51
+ return result.location
52
+ else:
53
+ logger.warning(f'No S3 client available, skipping object put')
54
+
55
+
56
+ @contextmanager
57
+ def get_object_stream(bucket_name: str, path: str):
58
+ if s3_client := ObjectStorage(s3_settings).get_client():
59
+ logger.debug(f'Getting object from object storage: {bucket_name}:{path}')
60
+
61
+ try:
62
+ response = s3_client.get_object(bucket_name, path)
63
+ except Exception as e:
64
+ logger.debug(f'Failed getting object from object storage: {bucket_name}:{path}', exc_info=e)
65
+
66
+ raise
67
+
68
+ yield response
69
+
70
+ response.close()
71
+ response.release_conn()
72
+ else:
73
+ logger.warning(f'No S3 client available, skipping object put')
74
+
75
+
76
+ def get_object(bucket_name: str, path: str) -> bytes:
77
+ with get_object_stream(bucket_name, path) as stream:
78
+ body = stream.read()
79
+
80
+ logger.debug(f'Loaded object from object storage: {bucket_name}:{path}')
81
+
82
+ return body
83
+
84
+
85
+ def list_objects(bucket_name: str, prefix: str, recursive: bool = True) -> Generator[Object, None, None]:
86
+ s3_client = ObjectStorage(s3_settings).get_client()
87
+
88
+ yield from s3_client.list_objects(bucket_name, prefix=prefix, recursive=recursive)
89
+
90
+
91
+ def get_objects(bucket_name: str, path: str,
92
+ recursive: bool = True) -> Generator[tuple[str, datetime, bytes], None, None]:
93
+ for obj in list_objects(bucket_name, path, recursive):
94
+ object_name = obj.object_name
95
+
96
+ if obj.size:
97
+ data = get_object(bucket_name, object_name)
98
+ else:
99
+ data = b''
100
+
101
+ yield object_name, obj.last_modified, data
102
+
103
+
104
+ def remove_object(bucket_name: str, object_name: str):
105
+ s3_client = ObjectStorage(s3_settings).get_client()
106
+ s3_client.remove_object(bucket_name, object_name)
107
+
108
+
109
+ def remove_objects(bucket_name: str, prefix: str = None,
110
+ object_names: Iterable[str] = None) -> Iterable[DeleteError] | None:
111
+ s3_client = ObjectStorage(s3_settings).get_client()
112
+
113
+ if prefix:
114
+ delete_object_list = map(
115
+ lambda obj: DeleteObject(obj.object_name), s3_client.list_objects(bucket_name, prefix=prefix,
116
+ recursive=True)
117
+ )
118
+ elif object_names:
119
+ delete_object_list = map(DeleteObject, object_names)
120
+ else:
121
+ return None
122
+
123
+ errors = s3_client.remove_objects(bucket_name, delete_object_list)
124
+
125
+ return errors
File without changes
@@ -0,0 +1,26 @@
1
+ import base64
2
+ import dataclasses
3
+ import json
4
+ from datetime import datetime, date
5
+ from decimal import Decimal
6
+ from socket import socket
7
+ from typing import Any
8
+
9
+
10
+ class CustomJSONEncoder(json.JSONEncoder):
11
+ def default(self, o) -> Any:
12
+ try:
13
+ return super(CustomJSONEncoder, self).default(o)
14
+ except TypeError:
15
+ if isinstance(o, datetime):
16
+ return o.isoformat()
17
+ elif isinstance(o, date):
18
+ return o.isoformat()
19
+ elif isinstance(o, bytes):
20
+ return base64.b64encode(o).decode('ascii')
21
+ elif dataclasses.is_dataclass(o):
22
+ return dataclasses.asdict(o)
23
+ elif isinstance(o, (Decimal, socket, type, Exception)):
24
+ return str(o)
25
+
26
+ return type(o).__name__
@@ -0,0 +1,50 @@
1
+ import dataclasses
2
+ import json
3
+ import logging
4
+ from datetime import datetime, date
5
+ from decimal import Decimal
6
+
7
+ import msgpack
8
+ from msgpack import ExtType
9
+
10
+ from python3_commons.serializers.json import CustomJSONEncoder
11
+
12
+ logger = logging.getLogger(__name__)
13
+
14
+
15
+ def msgpack_encoder(obj):
16
+ if isinstance(obj, Decimal):
17
+ return ExtType(1, str(obj).encode())
18
+ elif isinstance(obj, datetime):
19
+ return ExtType(2, obj.isoformat().encode())
20
+ elif isinstance(obj, date):
21
+ return ExtType(3, obj.isoformat().encode())
22
+ elif dataclasses.is_dataclass(obj):
23
+ return ExtType(4, json.dumps(dataclasses.asdict(obj), cls=CustomJSONEncoder).encode())
24
+
25
+ return f'no encoder for {obj}'
26
+
27
+
28
+ def msgpack_decoder(code, data):
29
+ if code == 1:
30
+ return Decimal(data.decode())
31
+ elif code == 2:
32
+ return datetime.fromisoformat(data.decode())
33
+ elif code == 3:
34
+ return date.fromisoformat(data.decode())
35
+ elif code == 4:
36
+ return json.loads(data)
37
+
38
+ return f'no decoder for type {code}'
39
+
40
+
41
+ def serialize_msgpack(data) -> bytes:
42
+ result = msgpack.packb(data, default=msgpack_encoder)
43
+
44
+ return result
45
+
46
+
47
+ def deserialize_msgpack(data: bytes):
48
+ result = msgpack.unpackb(data, ext_hook=msgpack_decoder)
49
+
50
+ return result
@@ -0,0 +1,59 @@
1
+ import dataclasses
2
+ import json
3
+ import logging
4
+ import struct
5
+ from _decimal import Decimal
6
+ from datetime import datetime, date
7
+ from typing import Any
8
+
9
+ from msgspec import msgpack
10
+ from msgspec.msgpack import Ext
11
+
12
+ from python3_commons.serializers.json import CustomJSONEncoder
13
+
14
+ logger = logging.getLogger(__name__)
15
+
16
+
17
+ def enc_hook(obj: Any) -> Any:
18
+ if isinstance(obj, Decimal):
19
+ return Ext(1, struct.pack('b', str(obj).encode()))
20
+ elif isinstance(obj, datetime):
21
+ return Ext(2, struct.pack('b', obj.isoformat().encode()))
22
+ elif isinstance(obj, date):
23
+ return Ext(3, struct.pack('b', obj.isoformat().encode()))
24
+ elif dataclasses.is_dataclass(obj):
25
+ return Ext(4, struct.pack('b', json.dumps(dataclasses.asdict(obj), cls=CustomJSONEncoder).encode()))
26
+
27
+ raise NotImplementedError(f'Objects of type {type(obj)} are not supported')
28
+
29
+
30
+ def ext_hook(code: int, data: memoryview) -> Any:
31
+ if code == 1:
32
+ return Decimal(data.tobytes().decode())
33
+ elif code == 2:
34
+ return datetime.fromisoformat(data.tobytes().decode())
35
+ elif code == 3:
36
+ return date.fromisoformat(data.tobytes().decode())
37
+ elif code == 4:
38
+ return json.loads(data.tobytes())
39
+
40
+ raise NotImplementedError(f'Extension type code {code} is not supported')
41
+
42
+
43
+ MSGPACK_ENCODER = msgpack.Encoder(enc_hook=enc_hook)
44
+ MSGPACK_DECODER = msgpack.Decoder(ext_hook=ext_hook)
45
+
46
+
47
+ def serialize_msgpack(data) -> bytes:
48
+ result = MSGPACK_ENCODER.encode(data)
49
+
50
+ return result
51
+
52
+
53
+ def deserialize_msgpack(data: bytes, data_type=None):
54
+ if data_type:
55
+ result = msgpack.decode(data, type=data_type)
56
+ else:
57
+ result = MSGPACK_DECODER.decode(data)
58
+
59
+ return result
@@ -0,0 +1,5 @@
1
+ ============
2
+ Contributors
3
+ ============
4
+
5
+ * Oleg Korsak <kamikaze.is.waiting.you@gmail.com>
@@ -0,0 +1,604 @@
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+
6
+ Everyone is permitted to copy and distribute verbatim copies of this license
7
+ document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The GNU General Public License is a free, copyleft license for software and
12
+ other kinds of works.
13
+
14
+ The licenses for most software and other practical works are designed to take
15
+ away your freedom to share and change the works. By contrast, the GNU General
16
+ Public License is intended to guarantee your freedom to share and change all
17
+ versions of a program--to make sure it remains free software for all its users.
18
+ We, the Free Software Foundation, use the GNU General Public License for most
19
+ of our software; it applies also to any other work released this way by its
20
+ authors. You can apply it to your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not price. Our
23
+ General Public Licenses are designed to make sure that you have the freedom
24
+ to distribute copies of free software (and charge for them if you wish), that
25
+ you receive source code or can get it if you want it, that you can change
26
+ the software or use pieces of it in new free programs, and that you know you
27
+ can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you these rights
30
+ or asking you to surrender the rights. Therefore, you have certain responsibilities
31
+ if you distribute copies of the software, or if you modify it: responsibilities
32
+ to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether gratis or
35
+ for a fee, you must pass on to the recipients the same freedoms that you received.
36
+ You must make sure that they, too, receive or can get the source code. And
37
+ you must show them these terms so they know their rights.
38
+
39
+ Developers that use the GNU GPL protect your rights with two steps: (1) assert
40
+ copyright on the software, and (2) offer you this License giving you legal
41
+ permission to copy, distribute and/or modify it.
42
+
43
+ For the developers' and authors' protection, the GPL clearly explains that
44
+ there is no warranty for this free software. For both users' and authors'
45
+ sake, the GPL requires that modified versions be marked as changed, so that
46
+ their problems will not be attributed erroneously to authors of previous versions.
47
+
48
+ Some devices are designed to deny users access to install or run modified
49
+ versions of the software inside them, although the manufacturer can do so.
50
+ This is fundamentally incompatible with the aim of protecting users' freedom
51
+ to change the software. The systematic pattern of such abuse occurs in the
52
+ area of products for individuals to use, which is precisely where it is most
53
+ unacceptable. Therefore, we have designed this version of the GPL to prohibit
54
+ the practice for those products. If such problems arise substantially in other
55
+ domains, we stand ready to extend this provision to those domains in future
56
+ versions of the GPL, as needed to protect the freedom of users.
57
+
58
+ Finally, every program is threatened constantly by software patents. States
59
+ should not allow patents to restrict development and use of software on general-purpose
60
+ computers, but in those that do, we wish to avoid the special danger that
61
+ patents applied to a free program could make it effectively proprietary. To
62
+ prevent this, the GPL assures that patents cannot be used to render the program
63
+ non-free.
64
+
65
+ The precise terms and conditions for copying, distribution and modification
66
+ follow.
67
+
68
+ TERMS AND CONDITIONS
69
+
70
+ 0. Definitions.
71
+
72
+ “This License” refers to version 3 of the GNU General Public License.
73
+
74
+ “Copyright” also means copyright-like laws that apply to other kinds of works,
75
+ such as semiconductor masks.
76
+
77
+ “The Program” refers to any copyrightable work licensed under this License.
78
+ Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals
79
+ or organizations.
80
+
81
+ To “modify” a work means to copy from or adapt all or part of the work in
82
+ a fashion requiring copyright permission, other than the making of an exact
83
+ copy. The resulting work is called a “modified version” of the earlier work
84
+ or a work “based on” the earlier work.
85
+
86
+ A “covered work” means either the unmodified Program or a work based on the
87
+ Program.
88
+
89
+ To “propagate” a work means to do anything with it that, without permission,
90
+ would make you directly or secondarily liable for infringement under applicable
91
+ copyright law, except executing it on a computer or modifying a private copy.
92
+ Propagation includes copying, distribution (with or without modification),
93
+ making available to the public, and in some countries other activities as
94
+ well.
95
+
96
+ To “convey” a work means any kind of propagation that enables other parties
97
+ to make or receive copies. Mere interaction with a user through a computer
98
+ network, with no transfer of a copy, is not conveying.
99
+
100
+ An interactive user interface displays “Appropriate Legal Notices” to the
101
+ extent that it includes a convenient and prominently visible feature that
102
+ (1) displays an appropriate copyright notice, and (2) tells the user that
103
+ there is no warranty for the work (except to the extent that warranties are
104
+ provided), that licensees may convey the work under this License, and how
105
+ to view a copy of this License. If the interface presents a list of user commands
106
+ or options, such as a menu, a prominent item in the list meets this criterion.
107
+
108
+ 1. Source Code.
109
+ The “source code” for a work means the preferred form of the work for making
110
+ modifications to it. “Object code” means any non-source form of a work.
111
+
112
+ A “Standard Interface” means an interface that either is an official standard
113
+ defined by a recognized standards body, or, in the case of interfaces specified
114
+ for a particular programming language, one that is widely used among developers
115
+ working in that language.
116
+
117
+ The “System Libraries” of an executable work include anything, other than
118
+ the work as a whole, that (a) is included in the normal form of packaging
119
+ a Major Component, but which is not part of that Major Component, and (b)
120
+ serves only to enable use of the work with that Major Component, or to implement
121
+ a Standard Interface for which an implementation is available to the public
122
+ in source code form. A “Major Component”, in this context, means a major essential
123
+ component (kernel, window system, and so on) of the specific operating system
124
+ (if any) on which the executable work runs, or a compiler used to produce
125
+ the work, or an object code interpreter used to run it.
126
+
127
+ The “Corresponding Source” for a work in object code form means all the source
128
+ code needed to generate, install, and (for an executable work) run the object
129
+ code and to modify the work, including scripts to control those activities.
130
+ However, it does not include the work's System Libraries, or general-purpose
131
+ tools or generally available free programs which are used unmodified in performing
132
+ those activities but which are not part of the work. For example, Corresponding
133
+ Source includes interface definition files associated with source files for
134
+ the work, and the source code for shared libraries and dynamically linked
135
+ subprograms that the work is specifically designed to require, such as by
136
+ intimate data communication or control flow between those subprograms and
137
+ other parts of the work.
138
+
139
+ The Corresponding Source need not include anything that users can regenerate
140
+ automatically from other parts of the Corresponding Source.
141
+
142
+ The Corresponding Source for a work in source code form is that same work.
143
+
144
+ 2. Basic Permissions.
145
+ All rights granted under this License are granted for the term of copyright
146
+ on the Program, and are irrevocable provided the stated conditions are met.
147
+ This License explicitly affirms your unlimited permission to run the unmodified
148
+ Program. The output from running a covered work is covered by this License
149
+ only if the output, given its content, constitutes a covered work. This License
150
+ acknowledges your rights of fair use or other equivalent, as provided by copyright
151
+ law.
152
+
153
+ You may make, run and propagate covered works that you do not convey, without
154
+ conditions so long as your license otherwise remains in force. You may convey
155
+ covered works to others for the sole purpose of having them make modifications
156
+ exclusively for you, or provide you with facilities for running those works,
157
+ provided that you comply with the terms of this License in conveying all material
158
+ for which you do not control copyright. Those thus making or running the covered
159
+ works for you must do so exclusively on your behalf, under your direction
160
+ and control, on terms that prohibit them from making any copies of your copyrighted
161
+ material outside their relationship with you.
162
+
163
+ Conveying under any other circumstances is permitted solely under the conditions
164
+ stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
165
+
166
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
167
+ No covered work shall be deemed part of an effective technological measure
168
+ under any applicable law fulfilling obligations under article 11 of the WIPO
169
+ copyright treaty adopted on 20 December 1996, or similar laws prohibiting
170
+ or restricting circumvention of such measures.
171
+
172
+ When you convey a covered work, you waive any legal power to forbid circumvention
173
+ of technological measures to the extent such circumvention is effected by
174
+ exercising rights under this License with respect to the covered work, and
175
+ you disclaim any intention to limit operation or modification of the work
176
+ as a means of enforcing, against the work's users, your or third parties'
177
+ legal rights to forbid circumvention of technological measures.
178
+
179
+ 4. Conveying Verbatim Copies.
180
+ You may convey verbatim copies of the Program's source code as you receive
181
+ it, in any medium, provided that you conspicuously and appropriately publish
182
+ on each copy an appropriate copyright notice; keep intact all notices stating
183
+ that this License and any non-permissive terms added in accord with section
184
+ 7 apply to the code; keep intact all notices of the absence of any warranty;
185
+ and give all recipients a copy of this License along with the Program.
186
+
187
+ You may charge any price or no price for each copy that you convey, and you
188
+ may offer support or warranty protection for a fee.
189
+
190
+ 5. Conveying Modified Source Versions.
191
+ You may convey a work based on the Program, or the modifications to produce
192
+ it from the Program, in the form of source code under the terms of section
193
+ 4, provided that you also meet all of these conditions:
194
+
195
+ a) The work must carry prominent notices stating that you modified it, and
196
+ giving a relevant date.
197
+
198
+ b) The work must carry prominent notices stating that it is released under
199
+ this License and any conditions added under section 7. This requirement modifies
200
+ the requirement in section 4 to “keep intact all notices”.
201
+
202
+ c) You must license the entire work, as a whole, under this License to anyone
203
+ who comes into possession of a copy. This License will therefore apply, along
204
+ with any applicable section 7 additional terms, to the whole of the work,
205
+ and all its parts, regardless of how they are packaged. This License gives
206
+ no permission to license the work in any other way, but it does not invalidate
207
+ such permission if you have separately received it.
208
+
209
+ d) If the work has interactive user interfaces, each must display Appropriate
210
+ Legal Notices; however, if the Program has interactive interfaces that do
211
+ not display Appropriate Legal Notices, your work need not make them do so.
212
+
213
+ A compilation of a covered work with other separate and independent works,
214
+ which are not by their nature extensions of the covered work, and which are
215
+ not combined with it such as to form a larger program, in or on a volume of
216
+ a storage or distribution medium, is called an “aggregate” if the compilation
217
+ and its resulting copyright are not used to limit the access or legal rights
218
+ of the compilation's users beyond what the individual works permit. Inclusion
219
+ of a covered work in an aggregate does not cause this License to apply to
220
+ the other parts of the aggregate.
221
+
222
+ 6. Conveying Non-Source Forms.
223
+ You may convey a covered work in object code form under the terms of sections
224
+ 4 and 5, provided that you also convey the machine-readable Corresponding
225
+ Source under the terms of this License, in one of these ways:
226
+
227
+ a) Convey the object code in, or embodied in, a physical product (including
228
+ a physical distribution medium), accompanied by the Corresponding Source fixed
229
+ on a durable physical medium customarily used for software interchange.
230
+
231
+ b) Convey the object code in, or embodied in, a physical product (including
232
+ a physical distribution medium), accompanied by a written offer, valid for
233
+ at least three years and valid for as long as you offer spare parts or customer
234
+ support for that product model, to give anyone who possesses the object code
235
+ either (1) a copy of the Corresponding Source for all the software in the
236
+ product that is covered by this License, on a durable physical medium customarily
237
+ used for software interchange, for a price no more than your reasonable cost
238
+ of physically performing this conveying of source, or (2) access to copy the
239
+ Corresponding Source from a network server at no charge.
240
+
241
+ c) Convey individual copies of the object code with a copy of the written
242
+ offer to provide the Corresponding Source. This alternative is allowed only
243
+ occasionally and noncommercially, and only if you received the object code
244
+ with such an offer, in accord with subsection 6b.
245
+
246
+ d) Convey the object code by offering access from a designated place (gratis
247
+ or for a charge), and offer equivalent access to the Corresponding Source
248
+ in the same way through the same place at no further charge. You need not
249
+ require recipients to copy the Corresponding Source along with the object
250
+ code. If the place to copy the object code is a network server, the Corresponding
251
+ Source may be on a different server (operated by you or a third party) that
252
+ supports equivalent copying facilities, provided you maintain clear directions
253
+ next to the object code saying where to find the Corresponding Source. Regardless
254
+ of what server hosts the Corresponding Source, you remain obligated to ensure
255
+ that it is available for as long as needed to satisfy these requirements.
256
+
257
+ e) Convey the object code using peer-to-peer transmission, provided you inform
258
+ other peers where the object code and Corresponding Source of the work are
259
+ being offered to the general public at no charge under subsection 6d.
260
+
261
+ A separable portion of the object code, whose source code is excluded from
262
+ the Corresponding Source as a System Library, need not be included in conveying
263
+ the object code work.
264
+
265
+ A “User Product” is either (1) a “consumer product”, which means any tangible
266
+ personal property which is normally used for personal, family, or household
267
+ purposes, or (2) anything designed or sold for incorporation into a dwelling.
268
+ In determining whether a product is a consumer product, doubtful cases shall
269
+ be resolved in favor of coverage. For a particular product received by a particular
270
+ user, “normally used” refers to a typical or common use of that class of product,
271
+ regardless of the status of the particular user or of the way in which the
272
+ particular user actually uses, or expects or is expected to use, the product.
273
+ A product is a consumer product regardless of whether the product has substantial
274
+ commercial, industrial or non-consumer uses, unless such uses represent the
275
+ only significant mode of use of the product.
276
+
277
+ “Installation Information” for a User Product means any methods, procedures,
278
+ authorization keys, or other information required to install and execute modified
279
+ versions of a covered work in that User Product from a modified version of
280
+ its Corresponding Source. The information must suffice to ensure that the
281
+ continued functioning of the modified object code is in no case prevented
282
+ or interfered with solely because modification has been made.
283
+
284
+ If you convey an object code work under this section in, or with, or specifically
285
+ for use in, a User Product, and the conveying occurs as part of a transaction
286
+ in which the right of possession and use of the User Product is transferred
287
+ to the recipient in perpetuity or for a fixed term (regardless of how the
288
+ transaction is characterized), the Corresponding Source conveyed under this
289
+ section must be accompanied by the Installation Information. But this requirement
290
+ does not apply if neither you nor any third party retains the ability to install
291
+ modified object code on the User Product (for example, the work has been installed
292
+ in ROM).
293
+
294
+ The requirement to provide Installation Information does not include a requirement
295
+ to continue to provide support service, warranty, or updates for a work that
296
+ has been modified or installed by the recipient, or for the User Product in
297
+ which it has been modified or installed. Access to a network may be denied
298
+ when the modification itself materially and adversely affects the operation
299
+ of the network or violates the rules and protocols for communication across
300
+ the network.
301
+
302
+ Corresponding Source conveyed, and Installation Information provided, in accord
303
+ with this section must be in a format that is publicly documented (and with
304
+ an implementation available to the public in source code form), and must require
305
+ no special password or key for unpacking, reading or copying.
306
+
307
+ 7. Additional Terms.
308
+ “Additional permissions” are terms that supplement the terms of this License
309
+ by making exceptions from one or more of its conditions. Additional permissions
310
+ that are applicable to the entire Program shall be treated as though they
311
+ were included in this License, to the extent that they are valid under applicable
312
+ law. If additional permissions apply only to part of the Program, that part
313
+ may be used separately under those permissions, but the entire Program remains
314
+ governed by this License without regard to the additional permissions.
315
+
316
+ When you convey a copy of a covered work, you may at your option remove any
317
+ additional permissions from that copy, or from any part of it. (Additional
318
+ permissions may be written to require their own removal in certain cases when
319
+ you modify the work.) You may place additional permissions on material, added
320
+ by you to a covered work, for which you have or can give appropriate copyright
321
+ permission.
322
+
323
+ Notwithstanding any other provision of this License, for material you add
324
+ to a covered work, you may (if authorized by the copyright holders of that
325
+ material) supplement the terms of this License with terms:
326
+
327
+ a) Disclaiming warranty or limiting liability differently from the terms of
328
+ sections 15 and 16 of this License; or
329
+
330
+ b) Requiring preservation of specified reasonable legal notices or author
331
+ attributions in that material or in the Appropriate Legal Notices displayed
332
+ by works containing it; or
333
+
334
+ c) Prohibiting misrepresentation of the origin of that material, or requiring
335
+ that modified versions of such material be marked in reasonable ways as different
336
+ from the original version; or
337
+
338
+ d) Limiting the use for publicity purposes of names of licensors or authors
339
+ of the material; or
340
+
341
+ e) Declining to grant rights under trademark law for use of some trade names,
342
+ trademarks, or service marks; or
343
+
344
+ f) Requiring indemnification of licensors and authors of that material by
345
+ anyone who conveys the material (or modified versions of it) with contractual
346
+ assumptions of liability to the recipient, for any liability that these contractual
347
+ assumptions directly impose on those licensors and authors.
348
+
349
+ All other non-permissive additional terms are considered “further restrictions”
350
+ within the meaning of section 10. If the Program as you received it, or any
351
+ part of it, contains a notice stating that it is governed by this License
352
+ along with a term that is a further restriction, you may remove that term.
353
+ If a license document contains a further restriction but permits relicensing
354
+ or conveying under this License, you may add to a covered work material governed
355
+ by the terms of that license document, provided that the further restriction
356
+ does not survive such relicensing or conveying.
357
+
358
+ If you add terms to a covered work in accord with this section, you must place,
359
+ in the relevant source files, a statement of the additional terms that apply
360
+ to those files, or a notice indicating where to find the applicable terms.
361
+
362
+ Additional terms, permissive or non-permissive, may be stated in the form
363
+ of a separately written license, or stated as exceptions; the above requirements
364
+ apply either way.
365
+
366
+ 8. Termination.
367
+ You may not propagate or modify a covered work except as expressly provided
368
+ under this License. Any attempt otherwise to propagate or modify it is void,
369
+ and will automatically terminate your rights under this License (including
370
+ any patent licenses granted under the third paragraph of section 11).
371
+
372
+ However, if you cease all violation of this License, then your license from
373
+ a particular copyright holder is reinstated (a) provisionally, unless and
374
+ until the copyright holder explicitly and finally terminates your license,
375
+ and (b) permanently, if the copyright holder fails to notify you of the violation
376
+ by some reasonable means prior to 60 days after the cessation.
377
+
378
+ Moreover, your license from a particular copyright holder is reinstated permanently
379
+ if the copyright holder notifies you of the violation by some reasonable means,
380
+ this is the first time you have received notice of violation of this License
381
+ (for any work) from that copyright holder, and you cure the violation prior
382
+ to 30 days after your receipt of the notice.
383
+
384
+ Termination of your rights under this section does not terminate the licenses
385
+ of parties who have received copies or rights from you under this License.
386
+ If your rights have been terminated and not permanently reinstated, you do
387
+ not qualify to receive new licenses for the same material under section 10.
388
+
389
+ 9. Acceptance Not Required for Having Copies.
390
+ You are not required to accept this License in order to receive or run a copy
391
+ of the Program. Ancillary propagation of a covered work occurring solely as
392
+ a consequence of using peer-to-peer transmission to receive a copy likewise
393
+ does not require acceptance. However, nothing other than this License grants
394
+ you permission to propagate or modify any covered work. These actions infringe
395
+ copyright if you do not accept this License. Therefore, by modifying or propagating
396
+ a covered work, you indicate your acceptance of this License to do so.
397
+
398
+ 10. Automatic Licensing of Downstream Recipients.
399
+ Each time you convey a covered work, the recipient automatically receives
400
+ a license from the original licensors, to run, modify and propagate that work,
401
+ subject to this License. You are not responsible for enforcing compliance
402
+ by third parties with this License.
403
+
404
+ An “entity transaction” is a transaction transferring control of an organization,
405
+ or substantially all assets of one, or subdividing an organization, or merging
406
+ organizations. If propagation of a covered work results from an entity transaction,
407
+ each party to that transaction who receives a copy of the work also receives
408
+ whatever licenses to the work the party's predecessor in interest had or could
409
+ give under the previous paragraph, plus a right to possession of the Corresponding
410
+ Source of the work from the predecessor in interest, if the predecessor has
411
+ it or can get it with reasonable efforts.
412
+
413
+ You may not impose any further restrictions on the exercise of the rights
414
+ granted or affirmed under this License. For example, you may not impose a
415
+ license fee, royalty, or other charge for exercise of rights granted under
416
+ this License, and you may not initiate litigation (including a cross-claim
417
+ or counterclaim in a lawsuit) alleging that any patent claim is infringed
418
+ by making, using, selling, offering for sale, or importing the Program or
419
+ any portion of it.
420
+
421
+ 11. Patents.
422
+ A “contributor” is a copyright holder who authorizes use under this License
423
+ of the Program or a work on which the Program is based. The work thus licensed
424
+ is called the contributor's “contributor version”.
425
+
426
+ A contributor's “essential patent claims” are all patent claims owned or controlled
427
+ by the contributor, whether already acquired or hereafter acquired, that would
428
+ be infringed by some manner, permitted by this License, of making, using,
429
+ or selling its contributor version, but do not include claims that would be
430
+ infringed only as a consequence of further modification of the contributor
431
+ version. For purposes of this definition, “control” includes the right to
432
+ grant patent sublicenses in a manner consistent with the requirements of this
433
+ License.
434
+
435
+ Each contributor grants you a non-exclusive, worldwide, royalty-free patent
436
+ license under the contributor's essential patent claims, to make, use, sell,
437
+ offer for sale, import and otherwise run, modify and propagate the contents
438
+ of its contributor version.
439
+
440
+ In the following three paragraphs, a “patent license” is any express agreement
441
+ or commitment, however denominated, not to enforce a patent (such as an express
442
+ permission to practice a patent or covenant not to sue for patent infringement).
443
+ To “grant” such a patent license to a party means to make such an agreement
444
+ or commitment not to enforce a patent against the party.
445
+
446
+ If you convey a covered work, knowingly relying on a patent license, and the
447
+ Corresponding Source of the work is not available for anyone to copy, free
448
+ of charge and under the terms of this License, through a publicly available
449
+ network server or other readily accessible means, then you must either (1)
450
+ cause the Corresponding Source to be so available, or (2) arrange to deprive
451
+ yourself of the benefit of the patent license for this particular work, or
452
+ (3) arrange, in a manner consistent with the requirements of this License,
453
+ to extend the patent license to downstream recipients. “Knowingly relying”
454
+ means you have actual knowledge that, but for the patent license, your conveying
455
+ the covered work in a country, or your recipient's use of the covered work
456
+ in a country, would infringe one or more identifiable patents in that country
457
+ that you have reason to believe are valid.
458
+
459
+ If, pursuant to or in connection with a single transaction or arrangement,
460
+ you convey, or propagate by procuring conveyance of, a covered work, and grant
461
+ a patent license to some of the parties receiving the covered work authorizing
462
+ them to use, propagate, modify or convey a specific copy of the covered work,
463
+ then the patent license you grant is automatically extended to all recipients
464
+ of the covered work and works based on it.
465
+
466
+ A patent license is “discriminatory” if it does not include within the scope
467
+ of its coverage, prohibits the exercise of, or is conditioned on the non-exercise
468
+ of one or more of the rights that are specifically granted under this License.
469
+ You may not convey a covered work if you are a party to an arrangement with
470
+ a third party that is in the business of distributing software, under which
471
+ you make payment to the third party based on the extent of your activity of
472
+ conveying the work, and under which the third party grants, to any of the
473
+ parties who would receive the covered work from you, a discriminatory patent
474
+ license (a) in connection with copies of the covered work conveyed by you
475
+ (or copies made from those copies), or (b) primarily for and in connection
476
+ with specific products or compilations that contain the covered work, unless
477
+ you entered into that arrangement, or that patent license was granted, prior
478
+ to 28 March 2007.
479
+
480
+ Nothing in this License shall be construed as excluding or limiting any implied
481
+ license or other defenses to infringement that may otherwise be available
482
+ to you under applicable patent law.
483
+
484
+ 12. No Surrender of Others' Freedom.
485
+ If conditions are imposed on you (whether by court order, agreement or otherwise)
486
+ that contradict the conditions of this License, they do not excuse you from
487
+ the conditions of this License. If you cannot convey a covered work so as
488
+ to satisfy simultaneously your obligations under this License and any other
489
+ pertinent obligations, then as a consequence you may not convey it at all.
490
+ For example, if you agree to terms that obligate you to collect a royalty
491
+ for further conveying from those to whom you convey the Program, the only
492
+ way you could satisfy both those terms and this License would be to refrain
493
+ entirely from conveying the Program.
494
+
495
+ 13. Use with the GNU Affero General Public License.
496
+ Notwithstanding any other provision of this License, you have permission to
497
+ link or combine any covered work with a work licensed under version 3 of the
498
+ GNU Affero General Public License into a single combined work, and to convey
499
+ the resulting work. The terms of this License will continue to apply to the
500
+ part which is the covered work, but the special requirements of the GNU Affero
501
+ General Public License, section 13, concerning interaction through a network
502
+ will apply to the combination as such.
503
+
504
+ 14. Revised Versions of this License.
505
+ The Free Software Foundation may publish revised and/or new versions of the
506
+ GNU General Public License from time to time. Such new versions will be similar
507
+ in spirit to the present version, but may differ in detail to address new
508
+ problems or concerns.
509
+
510
+ Each version is given a distinguishing version number. If the Program specifies
511
+ that a certain numbered version of the GNU General Public License “or any
512
+ later version” applies to it, you have the option of following the terms and
513
+ conditions either of that numbered version or of any later version published
514
+ by the Free Software Foundation. If the Program does not specify a version
515
+ number of the GNU General Public License, you may choose any version ever
516
+ published by the Free Software Foundation.
517
+
518
+ If the Program specifies that a proxy can decide which future versions of
519
+ the GNU General Public License can be used, that proxy's public statement
520
+ of acceptance of a version permanently authorizes you to choose that version
521
+ for the Program.
522
+
523
+ Later license versions may give you additional or different permissions. However,
524
+ no additional obligations are imposed on any author or copyright holder as
525
+ a result of your choosing to follow a later version.
526
+
527
+ 15. Disclaimer of Warranty.
528
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
529
+ LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
530
+ OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER
531
+ EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
532
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
533
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM
534
+ PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
535
+ CORRECTION.
536
+
537
+ 16. Limitation of Liability.
538
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
539
+ ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM
540
+ AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
541
+ INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO
542
+ USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
543
+ INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE
544
+ PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
545
+ PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
546
+
547
+ 17. Interpretation of Sections 15 and 16.
548
+ If the disclaimer of warranty and limitation of liability provided above cannot
549
+ be given local legal effect according to their terms, reviewing courts shall
550
+ apply local law that most closely approximates an absolute waiver of all civil
551
+ liability in connection with the Program, unless a warranty or assumption
552
+ of liability accompanies a copy of the Program in return for a fee.
553
+
554
+ END OF TERMS AND CONDITIONS
555
+
556
+ How to Apply These Terms to Your New Programs
557
+
558
+ If you develop a new program, and you want it to be of the greatest possible
559
+ use to the public, the best way to achieve this is to make it free software
560
+ which everyone can redistribute and change under these terms.
561
+
562
+ To do so, attach the following notices to the program. It is safest to attach
563
+ them to the start of each source file to most effectively state the exclusion
564
+ of warranty; and each file should have at least the “copyright” line and a
565
+ pointer to where the full notice is found.
566
+
567
+ <one line to give the program's name and a brief idea of what it does.>
568
+ Copyright (C) <year> <name of author>
569
+
570
+ This program is free software: you can redistribute it and/or modify it under
571
+ the terms of the GNU General Public License as published by the Free Software
572
+ Foundation, either version 3 of the License, or (at your option) any later
573
+ version.
574
+
575
+ This program is distributed in the hope that it will be useful, but WITHOUT
576
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
577
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
578
+
579
+ You should have received a copy of the GNU General Public License along with
580
+ this program. If not, see <http://www.gnu.org/licenses/>.
581
+
582
+ Also add information on how to contact you by electronic and paper mail.
583
+
584
+ If the program does terminal interaction, make it output a short notice like
585
+ this when it starts in an interactive mode:
586
+
587
+ <program> Copyright (C) <year> <name of author>
588
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
589
+ This is free software, and you are welcome to redistribute it under certain
590
+ conditions; type `show c' for details.
591
+
592
+ The hypothetical commands `show w' and `show c' should show the appropriate
593
+ parts of the General Public License. Of course, your program's commands might
594
+ be different; for a GUI interface, you would use an “about box”.
595
+
596
+ You should also get your employer (if you work as a programmer) or school,
597
+ if any, to sign a “copyright disclaimer” for the program, if necessary. For
598
+ more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>.
599
+
600
+ The GNU General Public License does not permit incorporating your program
601
+ into proprietary programs. If your program is a subroutine library, you may
602
+ consider it more useful to permit linking proprietary applications with the
603
+ library. If this is what you want to do, use the GNU Lesser General Public
604
+ License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.
@@ -0,0 +1,30 @@
1
+ Metadata-Version: 2.1
2
+ Name: python3-commons
3
+ Version: 0.5.37
4
+ Summary: Re-usable Python3 code
5
+ Author-email: Oleg Korsak <kamikaze.is.waiting.you@gmail.com>
6
+ License: gpl-3
7
+ Project-URL: Homepage, https://github.com/kamikaze/python3-commons
8
+ Project-URL: Documentation, https://github.com/kamikaze/python3-commons/wiki
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Programming Language :: Python
11
+ Requires-Python: >=3.12
12
+ Description-Content-Type: text/x-rst
13
+ License-File: LICENSE
14
+ License-File: AUTHORS.rst
15
+ Requires-Dist: asyncpg==0.30.0
16
+ Requires-Dist: lxml==5.3.0
17
+ Requires-Dist: minio==7.2.12
18
+ Requires-Dist: msgpack==1.1.0
19
+ Requires-Dist: msgspec==0.18.6
20
+ Requires-Dist: pydantic[email]==2.10.2
21
+ Requires-Dist: pydantic-settings==2.6.1
22
+ Requires-Dist: zeep==4.3.1
23
+ Provides-Extra: testing
24
+ Requires-Dist: pytest; extra == "testing"
25
+ Requires-Dist: pytest-cov; extra == "testing"
26
+
27
+ Re-usable Python3 code
28
+ ======================
29
+
30
+ Some description here
@@ -0,0 +1,20 @@
1
+ python3_commons/__init__.py,sha256=0KgaYU46H_IMKn-BuasoRN3C4Hi45KlkHHoPbU9cwiA,189
2
+ python3_commons/audit.py,sha256=fokdHYthtZWc1HQA2lZ74mQVkAh57oFzH-N97RS3tSc,5865
3
+ python3_commons/conf.py,sha256=qm2a2yWOhfawicBPjWnUett8TrsMtoyQXDxEJ_N-v-Y,637
4
+ python3_commons/db.py,sha256=qhaDIdzBWgFyeP_XPKfHZlYVlwS2bpBPYMv84yV6820,738
5
+ python3_commons/fs.py,sha256=wfLjybXndwLqNlOxTpm_HRJnuTcC4wbrHEOaEeCo9Wc,337
6
+ python3_commons/helpers.py,sha256=hZG8M-mltBC8I9yx5ZuAM7bABFNuOsqX6FzSaQz4y9U,2480
7
+ python3_commons/object_storage.py,sha256=pk2J14RL9FLTwaks-IS4EJX9TBMLzid35CroGftLNhU,4067
8
+ python3_commons/logging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ python3_commons/logging/filters.py,sha256=fuyjXZAUm-i2MNrxvFYag8F8Rr27x8W8MdV3ke6miSs,175
10
+ python3_commons/logging/formatters.py,sha256=UXmmh1yd5Kc2dpvSHn6uCWLDWE2LMjlYAaH8cg3siV4,720
11
+ python3_commons/serializers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ python3_commons/serializers/json.py,sha256=P288wWz9ic38QWEMrpp_uwKPYkQiOgvE1cI4WZn6ZCg,808
13
+ python3_commons/serializers/msgpack.py,sha256=tzIGGyDL3UpZnnouCtnxuYDx6InKM_C3PP1N4PN8wd4,1269
14
+ python3_commons/serializers/msgspec.py,sha256=EknuMpxi_kU25Iv_m10E9rk8b31AkjVumuzyjp7WgrU,1699
15
+ python3_commons-0.5.37.dist-info/AUTHORS.rst,sha256=3R9JnfjfjH5RoPWOeqKFJgxVShSSfzQPIrEr1nxIo9Q,90
16
+ python3_commons-0.5.37.dist-info/LICENSE,sha256=xxILuojHm4fKQOrMHPSslbyy6WuKAN2RiG74HbrYfzM,34575
17
+ python3_commons-0.5.37.dist-info/METADATA,sha256=Y3n2mFjXLsk6W8ohI0e8MkrWsln5-EYL-CoU-QhgXh0,944
18
+ python3_commons-0.5.37.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
19
+ python3_commons-0.5.37.dist-info/top_level.txt,sha256=lJI6sCBf68eUHzupCnn2dzG10lH3jJKTWM_hrN1cQ7M,16
20
+ python3_commons-0.5.37.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.6.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ python3_commons