diff --git a/.gitattributes b/.gitattributes index 3a9ecc73f4d51022773bba36d6a86ac6e26e8a8d..ad484fe923de846280a036bbdfb200849053dba6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -294,3 +294,6 @@ my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/utils. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5fd.cpython-38-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/defs.cpython-38-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5d.cpython-38-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5f.cpython-38-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/wrapt/_wrappers.cpython-38-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5.cpython-38-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cv2/__init__.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cv2/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..550482bd17db63a9c1cde891e93d888446ecd0b6 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cv2/__init__.py @@ -0,0 +1,181 @@ +''' +OpenCV Python binary extension loader +''' +import os +import importlib +import sys + +__all__ = [] + +try: + import numpy + import numpy.core.multiarray +except ImportError: + print('OpenCV bindings requires "numpy" package.') + print('Install it via command:') + print(' pip install numpy') + raise + +# TODO +# is_x64 = sys.maxsize > 2**32 + + +def __load_extra_py_code_for_module(base, name, enable_debug_print=False): + module_name = "{}.{}".format(__name__, name) + export_module_name = "{}.{}".format(base, name) + native_module = sys.modules.pop(module_name, None) + try: + py_module = importlib.import_module(module_name) + except ImportError as err: + if enable_debug_print: + print("Can't load Python code for module:", module_name, + ". Reason:", err) + # Extension doesn't contain extra py code + return False + + if not hasattr(base, name): + setattr(sys.modules[base], name, py_module) + sys.modules[export_module_name] = py_module + # If it is C extension module it is already loaded by cv2 package + if native_module: + setattr(py_module, "_native", native_module) + for k, v in filter(lambda kv: not hasattr(py_module, kv[0]), + native_module.__dict__.items()): + if enable_debug_print: print(' symbol({}): {} = {}'.format(name, k, v)) + setattr(py_module, k, v) + return True + + +def __collect_extra_submodules(enable_debug_print=False): + def modules_filter(module): + return all(( + # module is not internal + not module.startswith("_"), + not module.startswith("python-"), + # it is not a file + os.path.isdir(os.path.join(_extra_submodules_init_path, module)) + )) + if sys.version_info[0] < 3: + if enable_debug_print: + print("Extra submodules is loaded only for Python 3") + return [] + + __INIT_FILE_PATH = os.path.abspath(__file__) + _extra_submodules_init_path = os.path.dirname(__INIT_FILE_PATH) + return filter(modules_filter, os.listdir(_extra_submodules_init_path)) + + +def bootstrap(): + import sys + + import copy + save_sys_path = copy.copy(sys.path) + + if hasattr(sys, 'OpenCV_LOADER'): + print(sys.path) + raise ImportError('ERROR: recursion is detected during loading of "cv2" binary extensions. Check OpenCV installation.') + sys.OpenCV_LOADER = True + + DEBUG = False + if hasattr(sys, 'OpenCV_LOADER_DEBUG'): + DEBUG = True + + import platform + if DEBUG: print('OpenCV loader: os.name="{}" platform.system()="{}"'.format(os.name, str(platform.system()))) + + LOADER_DIR = os.path.dirname(os.path.abspath(os.path.realpath(__file__))) + + PYTHON_EXTENSIONS_PATHS = [] + BINARIES_PATHS = [] + + g_vars = globals() + l_vars = locals().copy() + + if sys.version_info[:2] < (3, 0): + from . load_config_py2 import exec_file_wrapper + else: + from . load_config_py3 import exec_file_wrapper + + def load_first_config(fnames, required=True): + for fname in fnames: + fpath = os.path.join(LOADER_DIR, fname) + if not os.path.exists(fpath): + if DEBUG: print('OpenCV loader: config not found, skip: {}'.format(fpath)) + continue + if DEBUG: print('OpenCV loader: loading config: {}'.format(fpath)) + exec_file_wrapper(fpath, g_vars, l_vars) + return True + if required: + raise ImportError('OpenCV loader: missing configuration file: {}. Check OpenCV installation.'.format(fnames)) + + load_first_config(['config.py'], True) + load_first_config([ + 'config-{}.{}.py'.format(sys.version_info[0], sys.version_info[1]), + 'config-{}.py'.format(sys.version_info[0]) + ], True) + + if DEBUG: print('OpenCV loader: PYTHON_EXTENSIONS_PATHS={}'.format(str(l_vars['PYTHON_EXTENSIONS_PATHS']))) + if DEBUG: print('OpenCV loader: BINARIES_PATHS={}'.format(str(l_vars['BINARIES_PATHS']))) + + applySysPathWorkaround = False + if hasattr(sys, 'OpenCV_REPLACE_SYS_PATH_0'): + applySysPathWorkaround = True + else: + try: + BASE_DIR = os.path.dirname(LOADER_DIR) + if sys.path[0] == BASE_DIR or os.path.realpath(sys.path[0]) == BASE_DIR: + applySysPathWorkaround = True + except: + if DEBUG: print('OpenCV loader: exception during checking workaround for sys.path[0]') + pass # applySysPathWorkaround is False + + for p in reversed(l_vars['PYTHON_EXTENSIONS_PATHS']): + sys.path.insert(1 if not applySysPathWorkaround else 0, p) + + if os.name == 'nt': + if sys.version_info[:2] >= (3, 8): # https://github.com/python/cpython/pull/12302 + for p in l_vars['BINARIES_PATHS']: + try: + os.add_dll_directory(p) + except Exception as e: + if DEBUG: print('Failed os.add_dll_directory(): '+ str(e)) + pass + os.environ['PATH'] = ';'.join(l_vars['BINARIES_PATHS']) + ';' + os.environ.get('PATH', '') + if DEBUG: print('OpenCV loader: PATH={}'.format(str(os.environ['PATH']))) + else: + # amending of LD_LIBRARY_PATH works for sub-processes only + os.environ['LD_LIBRARY_PATH'] = ':'.join(l_vars['BINARIES_PATHS']) + ':' + os.environ.get('LD_LIBRARY_PATH', '') + + if DEBUG: print("Relink everything from native cv2 module to cv2 package") + + py_module = sys.modules.pop("cv2") + + native_module = importlib.import_module("cv2") + + sys.modules["cv2"] = py_module + setattr(py_module, "_native", native_module) + + for item_name, item in filter(lambda kv: kv[0] not in ("__file__", "__loader__", "__spec__", + "__name__", "__package__"), + native_module.__dict__.items()): + if item_name not in g_vars: + g_vars[item_name] = item + + sys.path = save_sys_path # multiprocessing should start from bootstrap code (https://github.com/opencv/opencv/issues/18502) + + try: + del sys.OpenCV_LOADER + except Exception as e: + if DEBUG: + print("Exception during delete OpenCV_LOADER:", e) + + if DEBUG: print('OpenCV loader: binary extension... OK') + + for submodule in __collect_extra_submodules(DEBUG): + if __load_extra_py_code_for_module("cv2", submodule, DEBUG): + if DEBUG: print("Extra Python code for", submodule, "is loaded") + + if DEBUG: print('OpenCV loader: DONE') + + +bootstrap() diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cv2/load_config_py3.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cv2/load_config_py3.py new file mode 100644 index 0000000000000000000000000000000000000000..6f3b21ab862d42ed4572bcd52c2c41a72dbc0521 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cv2/load_config_py3.py @@ -0,0 +1,9 @@ +# flake8: noqa +import os +import sys + +if sys.version_info[:2] >= (3, 0): + def exec_file_wrapper(fpath, g_vars, l_vars): + with open(fpath) as f: + code = compile(f.read(), os.path.basename(fpath), 'exec') + exec(code, g_vars, l_vars) diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/docker_pycreds-0.4.0.dist-info/LICENSE b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/docker_pycreds-0.4.0.dist-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d645695673349e3947e8e5ae42332d0ac3164cd7 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/docker_pycreds-0.4.0.dist-info/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/docker_pycreds-0.4.0.dist-info/METADATA b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/docker_pycreds-0.4.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..f242f009c225b7773415bd4c4fd07d6ab8c4588d --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/docker_pycreds-0.4.0.dist-info/METADATA @@ -0,0 +1,62 @@ +Metadata-Version: 2.1 +Name: docker-pycreds +Version: 0.4.0 +Summary: Python bindings for the docker credentials store API +Home-page: https://github.com/shin-/dockerpy-creds +Author: UNKNOWN +Author-email: UNKNOWN +License: Apache License 2.0 +Platform: UNKNOWN +Classifier: Development Status :: 4 - Beta +Classifier: Environment :: Other Environment +Classifier: Intended Audience :: Developers +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.3 +Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Topic :: Utilities +Classifier: License :: OSI Approved :: Apache Software License +Requires-Dist: six (>=1.4.0) + +# docker-pycreds + +[![CircleCI](https://circleci.com/gh/shin-/dockerpy-creds/tree/master.svg?style=svg)](https://circleci.com/gh/shin-/dockerpy-creds/tree/master) + +Python bindings for the docker credentials store API + +## Credentials store info + +[Docker documentation page](https://docs.docker.com/engine/reference/commandline/login/#/credentials-store) + +## Requirements + +On top of the dependencies in `requirements.txt`, the `docker-credential` +executable for the platform must be installed on the user's system. + +## API usage + +```python + +import dockerpycreds + +store = dockerpycreds.Store('secretservice') +store.store( + server='https://index.docker.io/v1/', username='johndoe', + secret='hunter2' +) + +print(store.list()) + +print(store.get('https://index.docker.io/v1/')) + + +store.erase('https://index.docker.io/v1/') +``` + + diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/docker_pycreds-0.4.0.dist-info/RECORD b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/docker_pycreds-0.4.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..35bb55ddaf729050ba70a9a5481d37c7b753f139 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/docker_pycreds-0.4.0.dist-info/RECORD @@ -0,0 +1,19 @@ +docker_pycreds-0.4.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +docker_pycreds-0.4.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358 +docker_pycreds-0.4.0.dist-info/METADATA,sha256=FOmAKPL9hzMoIGVedpB45WzPyJmvEqUPoWIWElf5S18,1821 +docker_pycreds-0.4.0.dist-info/RECORD,, +docker_pycreds-0.4.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +docker_pycreds-0.4.0.dist-info/WHEEL,sha256=CihQvCnsGZQBGAHLEUMf0IdA4fRduS_NBUTMgCTtvPM,110 +docker_pycreds-0.4.0.dist-info/top_level.txt,sha256=iHN9Ul5VnNovfI4c7fel4nGnEtE4BezC_IQ8_3meRVw,14 +dockerpycreds/__init__.py,sha256=vdD-zY6geCywLcpf8Naplshb5a5dc8czaWtbL7VdEDE,116 +dockerpycreds/__pycache__/__init__.cpython-38.pyc,, +dockerpycreds/__pycache__/constants.cpython-38.pyc,, +dockerpycreds/__pycache__/errors.cpython-38.pyc,, +dockerpycreds/__pycache__/store.cpython-38.pyc,, +dockerpycreds/__pycache__/utils.cpython-38.pyc,, +dockerpycreds/__pycache__/version.cpython-38.pyc,, +dockerpycreds/constants.py,sha256=5HjRGorpVvkamvLBI9yLPvur1E0glaq_ZhuRfbVA_bE,142 +dockerpycreds/errors.py,sha256=ghtvHruuU_wK_f90fnoep-yoVNx4t-OpYrB84v2yHjg,576 +dockerpycreds/store.py,sha256=uTjPxLKzqWanbCWe7fGVJyZX9PKv6QRE5omRSz6J4qE,3799 +dockerpycreds/utils.py,sha256=_ErlaAETnJEvPbBRdrLKBzKCB37eH0uncCdBySPIIKo,1020 +dockerpycreds/version.py,sha256=G-VpNfv2NAp81lTH0IeEq1qv9H2RSJW_Bn2UuwqxF_M,91 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/docker_pycreds-0.4.0.dist-info/REQUESTED b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/docker_pycreds-0.4.0.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/docker_pycreds-0.4.0.dist-info/WHEEL b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/docker_pycreds-0.4.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..dea0e20ccdfea12acf80a5957c9212eace3c39de --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/docker_pycreds-0.4.0.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.32.2) +Root-Is-Purelib: true +Tag: py2-none-any +Tag: py3-none-any + diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/docker_pycreds-0.4.0.dist-info/top_level.txt b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/docker_pycreds-0.4.0.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..0628bf73ae1b8299ba6a38f1aefed717d1a3f24f --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/docker_pycreds-0.4.0.dist-info/top_level.txt @@ -0,0 +1 @@ +dockerpycreds diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/einops-0.4.1.dist-info/INSTALLER b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/einops-0.4.1.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/einops-0.4.1.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/filelock/_api.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/filelock/_api.py new file mode 100644 index 0000000000000000000000000000000000000000..2e9cdbad2bca3a01ae1a79568af37852fc250242 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/filelock/_api.py @@ -0,0 +1,323 @@ +from __future__ import annotations + +import contextlib +import logging +import os +import time +import warnings +from abc import ABC, abstractmethod +from dataclasses import dataclass +from threading import local +from typing import TYPE_CHECKING, Any, ClassVar +from weakref import WeakValueDictionary + +from ._error import Timeout + +if TYPE_CHECKING: + import sys + from types import TracebackType + + if sys.version_info >= (3, 11): # pragma: no cover (py311+) + from typing import Self + else: # pragma: no cover ( None: + self.lock = lock + + def __enter__(self) -> BaseFileLock: + return self.lock + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> None: + self.lock.release() + + +@dataclass +class FileLockContext: + """A dataclass which holds the context for a ``BaseFileLock`` object.""" + + # The context is held in a separate class to allow optional use of thread local storage via the + # ThreadLocalFileContext class. + + #: The path to the lock file. + lock_file: str + + #: The default timeout value. + timeout: float + + #: The mode for the lock files + mode: int + + #: The file descriptor for the *_lock_file* as it is returned by the os.open() function, not None when lock held + lock_file_fd: int | None = None + + #: The lock counter is used for implementing the nested locking mechanism. + lock_counter: int = 0 # When the lock is acquired is increased and the lock is only released, when this value is 0 + + +class ThreadLocalFileContext(FileLockContext, local): + """A thread local version of the ``FileLockContext`` class.""" + + +class BaseFileLock(ABC, contextlib.ContextDecorator): + """Abstract base class for a file lock object.""" + + _instances: ClassVar[WeakValueDictionary[str, BaseFileLock]] = WeakValueDictionary() + + def __new__( # noqa: PLR0913 + cls, + lock_file: str | os.PathLike[str], + timeout: float = -1, # noqa: ARG003 + mode: int = 0o644, # noqa: ARG003 + thread_local: bool = True, # noqa: ARG003, FBT001, FBT002 + *, + is_singleton: bool = False, + **kwargs: dict[str, Any], # capture remaining kwargs for subclasses # noqa: ARG003 + ) -> Self: + """Create a new lock object or if specified return the singleton instance for the lock file.""" + if not is_singleton: + return super().__new__(cls) + + instance = cls._instances.get(str(lock_file)) + if not instance: + instance = super().__new__(cls) + cls._instances[str(lock_file)] = instance + + return instance # type: ignore[return-value] # https://github.com/python/mypy/issues/15322 + + def __init__( # noqa: PLR0913 + self, + lock_file: str | os.PathLike[str], + timeout: float = -1, + mode: int = 0o644, + thread_local: bool = True, # noqa: FBT001, FBT002 + *, + is_singleton: bool = False, + ) -> None: + """ + Create a new lock object. + + :param lock_file: path to the file + :param timeout: default timeout when acquiring the lock, in seconds. It will be used as fallback value in \ + the acquire method, if no timeout value (``None``) is given. If you want to disable the timeout, set it \ + to a negative value. A timeout of 0 means, that there is exactly one attempt to acquire the file lock. + :param mode: file permissions for the lockfile + :param thread_local: Whether this object's internal context should be thread local or not. If this is set to \ + ``False`` then the lock will be reentrant across threads. + :param is_singleton: If this is set to ``True`` then only one instance of this class will be created \ + per lock file. This is useful if you want to use the lock object for reentrant locking without needing \ + to pass the same object around. + """ + self._is_thread_local = thread_local + self._is_singleton = is_singleton + + # Create the context. Note that external code should not work with the context directly and should instead use + # properties of this class. + kwargs: dict[str, Any] = { + "lock_file": os.fspath(lock_file), + "timeout": timeout, + "mode": mode, + } + self._context: FileLockContext = (ThreadLocalFileContext if thread_local else FileLockContext)(**kwargs) + + def is_thread_local(self) -> bool: + """:return: a flag indicating if this lock is thread local or not""" + return self._is_thread_local + + @property + def is_singleton(self) -> bool: + """:return: a flag indicating if this lock is singleton or not""" + return self._is_singleton + + @property + def lock_file(self) -> str: + """:return: path to the lock file""" + return self._context.lock_file + + @property + def timeout(self) -> float: + """ + :return: the default timeout value, in seconds + + .. versionadded:: 2.0.0 + """ + return self._context.timeout + + @timeout.setter + def timeout(self, value: float | str) -> None: + """ + Change the default timeout value. + + :param value: the new value, in seconds + """ + self._context.timeout = float(value) + + @abstractmethod + def _acquire(self) -> None: + """If the file lock could be acquired, self._context.lock_file_fd holds the file descriptor of the lock file.""" + raise NotImplementedError + + @abstractmethod + def _release(self) -> None: + """Releases the lock and sets self._context.lock_file_fd to None.""" + raise NotImplementedError + + @property + def is_locked(self) -> bool: + """ + + :return: A boolean indicating if the lock file is holding the lock currently. + + .. versionchanged:: 2.0.0 + + This was previously a method and is now a property. + """ + return self._context.lock_file_fd is not None + + @property + def lock_counter(self) -> int: + """:return: The number of times this lock has been acquired (but not yet released).""" + return self._context.lock_counter + + def acquire( + self, + timeout: float | None = None, + poll_interval: float = 0.05, + *, + poll_intervall: float | None = None, + blocking: bool = True, + ) -> AcquireReturnProxy: + """ + Try to acquire the file lock. + + :param timeout: maximum wait time for acquiring the lock, ``None`` means use the default :attr:`~timeout` is and + if ``timeout < 0``, there is no timeout and this method will block until the lock could be acquired + :param poll_interval: interval of trying to acquire the lock file + :param poll_intervall: deprecated, kept for backwards compatibility, use ``poll_interval`` instead + :param blocking: defaults to True. If False, function will return immediately if it cannot obtain a lock on the + first attempt. Otherwise, this method will block until the timeout expires or the lock is acquired. + :raises Timeout: if fails to acquire lock within the timeout period + :return: a context object that will unlock the file when the context is exited + + .. code-block:: python + + # You can use this method in the context manager (recommended) + with lock.acquire(): + pass + + # Or use an equivalent try-finally construct: + lock.acquire() + try: + pass + finally: + lock.release() + + .. versionchanged:: 2.0.0 + + This method returns now a *proxy* object instead of *self*, + so that it can be used in a with statement without side effects. + + """ + # Use the default timeout, if no timeout is provided. + if timeout is None: + timeout = self._context.timeout + + if poll_intervall is not None: + msg = "use poll_interval instead of poll_intervall" + warnings.warn(msg, DeprecationWarning, stacklevel=2) + poll_interval = poll_intervall + + # Increment the number right at the beginning. We can still undo it, if something fails. + self._context.lock_counter += 1 + + lock_id = id(self) + lock_filename = self.lock_file + start_time = time.perf_counter() + try: + while True: + if not self.is_locked: + _LOGGER.debug("Attempting to acquire lock %s on %s", lock_id, lock_filename) + self._acquire() + if self.is_locked: + _LOGGER.debug("Lock %s acquired on %s", lock_id, lock_filename) + break + if blocking is False: + _LOGGER.debug("Failed to immediately acquire lock %s on %s", lock_id, lock_filename) + raise Timeout(lock_filename) # noqa: TRY301 + if 0 <= timeout < time.perf_counter() - start_time: + _LOGGER.debug("Timeout on acquiring lock %s on %s", lock_id, lock_filename) + raise Timeout(lock_filename) # noqa: TRY301 + msg = "Lock %s not acquired on %s, waiting %s seconds ..." + _LOGGER.debug(msg, lock_id, lock_filename, poll_interval) + time.sleep(poll_interval) + except BaseException: # Something did go wrong, so decrement the counter. + self._context.lock_counter = max(0, self._context.lock_counter - 1) + raise + return AcquireReturnProxy(lock=self) + + def release(self, force: bool = False) -> None: # noqa: FBT001, FBT002 + """ + Releases the file lock. Please note, that the lock is only completely released, if the lock counter is 0. Also + note, that the lock file itself is not automatically deleted. + + :param force: If true, the lock counter is ignored and the lock is released in every case/ + """ + if self.is_locked: + self._context.lock_counter -= 1 + + if self._context.lock_counter == 0 or force: + lock_id, lock_filename = id(self), self.lock_file + + _LOGGER.debug("Attempting to release lock %s on %s", lock_id, lock_filename) + self._release() + self._context.lock_counter = 0 + _LOGGER.debug("Lock %s released on %s", lock_id, lock_filename) + + def __enter__(self) -> Self: + """ + Acquire the lock. + + :return: the lock object + """ + self.acquire() + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> None: + """ + Release the lock. + + :param exc_type: the exception type if raised + :param exc_value: the exception value if raised + :param traceback: the exception traceback if raised + """ + self.release() + + def __del__(self) -> None: + """Called when the lock object is deleted.""" + self.release(force=True) + + +__all__ = [ + "BaseFileLock", + "AcquireReturnProxy", +] diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/filelock/_unix.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/filelock/_unix.py new file mode 100644 index 0000000000000000000000000000000000000000..93ce3be58fbea2a736072cddb0dc5d6454395cc2 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/filelock/_unix.py @@ -0,0 +1,65 @@ +from __future__ import annotations + +import os +import sys +from contextlib import suppress +from errno import ENOSYS +from typing import cast + +from ._api import BaseFileLock +from ._util import ensure_directory_exists + +#: a flag to indicate if the fcntl API is available +has_fcntl = False +if sys.platform == "win32": # pragma: win32 cover + + class UnixFileLock(BaseFileLock): + """Uses the :func:`fcntl.flock` to hard lock the lock file on unix systems.""" + + def _acquire(self) -> None: + raise NotImplementedError + + def _release(self) -> None: + raise NotImplementedError + +else: # pragma: win32 no cover + try: + import fcntl + except ImportError: + pass + else: + has_fcntl = True + + class UnixFileLock(BaseFileLock): + """Uses the :func:`fcntl.flock` to hard lock the lock file on unix systems.""" + + def _acquire(self) -> None: + ensure_directory_exists(self.lock_file) + open_flags = os.O_RDWR | os.O_CREAT | os.O_TRUNC + fd = os.open(self.lock_file, open_flags, self._context.mode) + with suppress(PermissionError): # This locked is not owned by this UID + os.fchmod(fd, self._context.mode) + try: + fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB) + except OSError as exception: + os.close(fd) + if exception.errno == ENOSYS: # NotImplemented error + msg = "FileSystem does not appear to support flock; user SoftFileLock instead" + raise NotImplementedError(msg) from exception + else: + self._context.lock_file_fd = fd + + def _release(self) -> None: + # Do not remove the lockfile: + # https://github.com/tox-dev/py-filelock/issues/31 + # https://stackoverflow.com/questions/17708885/flock-removing-locked-file-without-race-condition + fd = cast(int, self._context.lock_file_fd) + self._context.lock_file_fd = None + fcntl.flock(fd, fcntl.LOCK_UN) + os.close(fd) + + +__all__ = [ + "has_fcntl", + "UnixFileLock", +] diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/filelock/_util.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/filelock/_util.py new file mode 100644 index 0000000000000000000000000000000000000000..543c1394678821cef6bdcbfeb59a545b99d0a7cf --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/filelock/_util.py @@ -0,0 +1,47 @@ +from __future__ import annotations + +import os +import stat +import sys +from errno import EACCES, EISDIR +from pathlib import Path + + +def raise_on_not_writable_file(filename: str) -> None: + """ + Raise an exception if attempting to open the file for writing would fail. + This is done so files that will never be writable can be separated from + files that are writable but currently locked + :param filename: file to check + :raises OSError: as if the file was opened for writing. + """ + try: # use stat to do exists + can write to check without race condition + file_stat = os.stat(filename) # noqa: PTH116 + except OSError: + return # swallow does not exist or other errors + + if file_stat.st_mtime != 0: # if os.stat returns but modification is zero that's an invalid os.stat - ignore it + if not (file_stat.st_mode & stat.S_IWUSR): + raise PermissionError(EACCES, "Permission denied", filename) + + if stat.S_ISDIR(file_stat.st_mode): + if sys.platform == "win32": # pragma: win32 cover + # On Windows, this is PermissionError + raise PermissionError(EACCES, "Permission denied", filename) + else: # pragma: win32 no cover # noqa: RET506 + # On linux / macOS, this is IsADirectoryError + raise IsADirectoryError(EISDIR, "Is a directory", filename) + + +def ensure_directory_exists(filename: Path | str) -> None: + """ + Ensure the directory containing the file exists (create it if necessary) + :param filename: file. + """ + Path(filename).parent.mkdir(parents=True, exist_ok=True) + + +__all__ = [ + "raise_on_not_writable_file", + "ensure_directory_exists", +] diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/filelock/py.typed b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/filelock/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5.cpython-38-x86_64-linux-gnu.so b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5.cpython-38-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..085020dd5f47b4980f0d7966be342566e0d81de9 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5.cpython-38-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9bd8b2c9d5f9c812bde2780c63ad38c986ecf939d0dfd2b701102f0d0ba5829e +size 265208 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5f.cpython-38-x86_64-linux-gnu.so b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5f.cpython-38-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..7923c25db1e1978442631c6576467462ac8b8d7f --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5f.cpython-38-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:926a102964bde03e17f0809cd42688b579e9f8faf9065a625d9c1a106039695d +size 289768 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/humanize-4.2.2.dist-info/INSTALLER b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/humanize-4.2.2.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/humanize-4.2.2.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/humanize-4.2.2.dist-info/METADATA b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/humanize-4.2.2.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..afda54ec7613dffb8a942c132f123326bda60c93 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/humanize-4.2.2.dist-info/METADATA @@ -0,0 +1,264 @@ +Metadata-Version: 2.1 +Name: humanize +Version: 4.2.2 +Summary: Python humanize utilities +Home-page: https://github.com/python-humanize/humanize +Author: Jason Moiron +Author-email: jmoiron@jmoiron.net +Maintainer: Hugo van Kemenade +License: MIT +Project-URL: Source, https://github.com/python-humanize/humanize +Project-URL: Issue tracker, https://github.com/python-humanize/humanize/issues +Project-URL: Funding, https://tidelift.com/subscription/pkg/pypi-humanize?utm_source=pypi-humanize&utm_medium=pypi +Project-URL: Documentation, https://python-humanize.readthedocs.io/ +Project-URL: Release notes, https://github.com/python-humanize/humanize/releases +Keywords: humanize time size +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Text Processing +Classifier: Topic :: Text Processing :: General +Requires-Python: >=3.7 +Description-Content-Type: text/markdown +License-File: LICENCE +Requires-Dist: importlib-metadata ; python_version < "3.8" +Provides-Extra: tests +Requires-Dist: freezegun ; extra == 'tests' +Requires-Dist: pytest ; extra == 'tests' +Requires-Dist: pytest-cov ; extra == 'tests' + +# humanize + +[![PyPI version](https://img.shields.io/pypi/v/humanize.svg?logo=pypi&logoColor=FFE873)](https://pypi.org/project/humanize/) +[![Supported Python versions](https://img.shields.io/pypi/pyversions/humanize.svg?logo=python&logoColor=FFE873)](https://pypi.org/project/humanize/) +[![Documentation Status](https://readthedocs.org/projects/python-humanize/badge/?version=latest)](https://python-humanize.readthedocs.io/en/latest/?badge=latest) +[![PyPI downloads](https://img.shields.io/pypi/dm/humanize.svg)](https://pypistats.org/packages/humanize) +[![GitHub Actions status](https://github.com/python-humanize/humanize/workflows/Test/badge.svg)](https://github.com/python-humanize/humanize/actions) +[![codecov](https://codecov.io/gh/python-humanize/humanize/branch/main/graph/badge.svg)](https://codecov.io/gh/python-humanize/humanize) +[![MIT License](https://img.shields.io/github/license/python-humanize/humanize.svg)](LICENCE) +[![Tidelift](https://tidelift.com/badges/package/pypi/humanize)](https://tidelift.com/subscription/pkg/pypi-humanize?utm_source=pypi-humanize&utm_medium=badge) + +This modest package contains various common humanization utilities, like turning +a number into a fuzzy human-readable duration ("3 minutes ago") or into a +human-readable size or throughput. It is localized to: + +- Arabic +- Bengali +- Brazilian Portuguese +- Catalan +- Danish +- Dutch +- European Portuguese +- Finnish +- French +- German +- Indonesian +- Italian +- Japanese +- Korean +- Persian +- Polish +- Russian +- Simplified Chinese +- Slovak +- Slovenian +- Spanish +- Swedish +- Turkish +- Ukrainian +- Vietnamese + +## API reference + +[https://python-humanize.readthedocs.io](https://python-humanize.readthedocs.io) + + + +## Usage + +### Integer humanization + +```pycon +>>> import humanize +>>> humanize.intcomma(12345) +'12,345' +>>> humanize.intword(123455913) +'123.5 million' +>>> humanize.intword(12345591313) +'12.3 billion' +>>> humanize.apnumber(4) +'four' +>>> humanize.apnumber(41) +'41' +``` + +### Date & time humanization + +```pycon +>>> import humanize +>>> import datetime as dt +>>> humanize.naturalday(dt.datetime.now()) +'today' +>>> humanize.naturaldelta(dt.timedelta(seconds=1001)) +'16 minutes' +>>> humanize.naturalday(dt.datetime.now() - dt.timedelta(days=1)) +'yesterday' +>>> humanize.naturalday(dt.date(2007, 6, 5)) +'Jun 05' +>>> humanize.naturaldate(dt.date(2007, 6, 5)) +'Jun 05 2007' +>>> humanize.naturaltime(dt.datetime.now() - dt.timedelta(seconds=1)) +'a second ago' +>>> humanize.naturaltime(dt.datetime.now() - dt.timedelta(seconds=3600)) +'an hour ago' +``` + +### Precise time delta + +```pycon +>>> import humanize +>>> import datetime as dt +>>> delta = dt.timedelta(seconds=3633, days=2, microseconds=123000) +>>> humanize.precisedelta(delta) +'2 days, 1 hour and 33.12 seconds' +>>> humanize.precisedelta(delta, minimum_unit="microseconds") +'2 days, 1 hour, 33 seconds and 123 milliseconds' +>>> humanize.precisedelta(delta, suppress=["days"], format="%0.4f") +'49 hours and 33.1230 seconds' +``` + +#### Smaller units + +If seconds are too large, set `minimum_unit` to milliseconds or microseconds: + +```pycon +>>> import humanize +>>> import datetime as dt +>>> humanize.naturaldelta(dt.timedelta(seconds=2)) +'2 seconds' +``` + +```pycon +>>> delta = dt.timedelta(milliseconds=4) +>>> humanize.naturaldelta(delta) +'a moment' +>>> humanize.naturaldelta(delta, minimum_unit="milliseconds") +'4 milliseconds' +>>> humanize.naturaldelta(delta, minimum_unit="microseconds") +'4 milliseconds' +``` + +```pycon +>>> humanize.naturaltime(delta) +'now' +>>> humanize.naturaltime(delta, minimum_unit="milliseconds") +'4 milliseconds ago' +>>> humanize.naturaltime(delta, minimum_unit="microseconds") +'4 milliseconds ago' +``` + +### File size humanization + +```pycon +>>> import humanize +>>> humanize.naturalsize(1_000_000) +'1.0 MB' +>>> humanize.naturalsize(1_000_000, binary=True) +'976.6 KiB' +>>> humanize.naturalsize(1_000_000, gnu=True) +'976.6K' +``` + +### Human-readable floating point numbers + +```pycon +>>> import humanize +>>> humanize.fractional(1/3) +'1/3' +>>> humanize.fractional(1.5) +'1 1/2' +>>> humanize.fractional(0.3) +'3/10' +>>> humanize.fractional(0.333) +'333/1000' +>>> humanize.fractional(1) +'1' +``` + +### Scientific notation + +```pycon +>>> import humanize +>>> humanize.scientific(0.3) +'3.00 x 10⁻¹' +>>> humanize.scientific(500) +'5.00 x 10²' +>>> humanize.scientific("20000") +'2.00 x 10⁴' +>>> humanize.scientific(1**10) +'1.00 x 10⁰' +>>> humanize.scientific(1**10, precision=1) +'1.0 x 10⁰' +>>> humanize.scientific(1**10, precision=0) +'1 x 10⁰' +``` + +## Localization + +How to change locale at runtime: + +```pycon +>>> import humanize +>>> import datetime as dt +>>> humanize.naturaltime(dt.timedelta(seconds=3)) +'3 seconds ago' +>>> _t = humanize.i18n.activate("ru_RU") +>>> humanize.naturaltime(dt.timedelta(seconds=3)) +'3 секунды назад' +>>> humanize.i18n.deactivate() +>>> humanize.naturaltime(dt.timedelta(seconds=3)) +'3 seconds ago' +``` + +You can pass additional parameter `path` to `activate` to specify a path to search +locales in. + +```pycon +>>> import humanize +>>> humanize.i18n.activate("xx_XX") +<...> +FileNotFoundError: [Errno 2] No translation file found for domain: 'humanize' +>>> humanize.i18n.activate("pt_BR", path="path/to/my/own/translation/") + +``` + + + +How to add new phrases to existing locale files: + +```console +$ xgettext --from-code=UTF-8 -o humanize.pot -k'_' -k'N_' -k'P_:1c,2' -l python src/humanize/*.py # extract new phrases +$ msgmerge -U src/humanize/locale/ru_RU/LC_MESSAGES/humanize.po humanize.pot # add them to locale files +``` + +How to add a new locale: + +```console +$ msginit -i humanize.pot -o humanize/locale//LC_MESSAGES/humanize.po --locale +``` + +Where `` is a locale abbreviation, eg. `en_GB`, `pt_BR` or just `ru`, `fr` +etc. + +List the language at the top of this README. diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/humanize-4.2.2.dist-info/RECORD b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/humanize-4.2.2.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..532c4e52ba436ceea0d2792371023ed3370c7a44 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/humanize-4.2.2.dist-info/RECORD @@ -0,0 +1,70 @@ +humanize-4.2.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +humanize-4.2.2.dist-info/LICENCE,sha256=i6bBgRKkMUAK08dD9wZwB5swJUXZiIT8LyipHDg6A4A,1078 +humanize-4.2.2.dist-info/METADATA,sha256=RceLVGyIQlQIoZ6XiIxa6J4Gn6WTbFoOD5dGgKlZusA,7672 +humanize-4.2.2.dist-info/RECORD,, +humanize-4.2.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +humanize-4.2.2.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92 +humanize-4.2.2.dist-info/top_level.txt,sha256=1B-bfyhHo8hE-z_Kn_iBhAmKipLlcRema3YIwAD3u5A,9 +humanize/__init__.py,sha256=eHXLDwlS7FrYU_GU0bCoUeYN6SPwz-UH0f2y1aBbTzo,959 +humanize/__pycache__/__init__.cpython-38.pyc,, +humanize/__pycache__/filesize.cpython-38.pyc,, +humanize/__pycache__/i18n.cpython-38.pyc,, +humanize/__pycache__/number.cpython-38.pyc,, +humanize/__pycache__/time.cpython-38.pyc,, +humanize/filesize.py,sha256=-SZ1l1-SquKegx6kky5BM4S5HDslieExwXaiAdctvNA,2273 +humanize/i18n.py,sha256=i7WgiA02FSv2jpPCYOjmp6AQrFTQvhSbdBkbnGRimDQ,4625 +humanize/locale/ar/LC_MESSAGES/humanize.mo,sha256=eFh_sqyVD47W3cHxJcHwJBM4qbdP2nBI9QXjZnw3BBk,3856 +humanize/locale/ar/LC_MESSAGES/humanize.po,sha256=2QWYaZhxAQukPl5RmBFNsC4yE-1DTP5JunSmf4RlDXg,6933 +humanize/locale/bn_BD/LC_MESSAGES/humanize.mo,sha256=6NB9epGOIUwSsUY7lUD-aW9IFAdLw1z_TGIZen1Fb9w,2399 +humanize/locale/bn_BD/LC_MESSAGES/humanize.po,sha256=sM2dzgpJ6n8unSxSwA0jpBd4ZbUphm2k96vim1aTIgo,5554 +humanize/locale/ca_ES/LC_MESSAGES/humanize.mo,sha256=veqJwGHEzymT-ott8nPopAm2SZ4wto3yJRzU8JGXIG8,3345 +humanize/locale/ca_ES/LC_MESSAGES/humanize.po,sha256=bjUvQssMTmw2rjYoeam2r13j4CP_Efu8txHS_XzTsjA,6489 +humanize/locale/da_DK/LC_MESSAGES/humanize.mo,sha256=m_IEC2ajKBYYw9Sh-_CwYIX0-vrwIHQ6nacChzInfOI,3524 +humanize/locale/da_DK/LC_MESSAGES/humanize.po,sha256=C693HAYkm-1kMZVDul5pWPD0i93yu-xNGgKHRnDT6Zs,6619 +humanize/locale/de_DE/LC_MESSAGES/humanize.mo,sha256=Evtv5Sz2GCNTW7S413xfqRC-hmPiz-uKOgh5m2Cyf78,3291 +humanize/locale/de_DE/LC_MESSAGES/humanize.po,sha256=rg0H3I7F7Bbto35yEATC1CL54vviXaRhJ_I60XG4-0I,6647 +humanize/locale/es_ES/LC_MESSAGES/humanize.mo,sha256=WRam8vl8OU2O76EkwQmhMVeliuZKO3W2_6zP9yp63W0,3466 +humanize/locale/es_ES/LC_MESSAGES/humanize.po,sha256=TT3ln5Dbf4ykXY-G5JffiBt96vOFhc2NbR1WTtgOpxU,6594 +humanize/locale/fa_IR/LC_MESSAGES/humanize.mo,sha256=42B1yDpYHdrnMVev01aEr_BaLlq-gMvh17CfjTM1HBI,4010 +humanize/locale/fa_IR/LC_MESSAGES/humanize.po,sha256=XW0FDUzPO3WbDwiaCusFe3t68SNkU3JIIB6JB1TmfVQ,7124 +humanize/locale/fi_FI/LC_MESSAGES/humanize.mo,sha256=5lleMFhHuP2dkg01BewxrLcPWBE-W8CdCNWSme1E1kI,3369 +humanize/locale/fi_FI/LC_MESSAGES/humanize.po,sha256=yMiEAY0Wjzum2MoXbGIqLc_jK7DvZrasg5Wxk7_R-uo,6697 +humanize/locale/fr_FR/LC_MESSAGES/humanize.mo,sha256=dPGlVRVq25z1w8AZwgZQUuAGlnwTr1fsHr0V3Ou-5QM,2645 +humanize/locale/fr_FR/LC_MESSAGES/humanize.po,sha256=9ykifaVg2d9KXBqimfyOfPkyrAUUXG9XqdkZKZA98H4,6905 +humanize/locale/id_ID/LC_MESSAGES/humanize.mo,sha256=6kl6Wh4ROJODFTkIbhV6UQ2JKT1inQn9lDxUeEepUTw,3005 +humanize/locale/id_ID/LC_MESSAGES/humanize.po,sha256=HXhSoHca2AXAvz4k6pNTzyfvoTr22AmYgoUsosmeE8U,6057 +humanize/locale/it_IT/LC_MESSAGES/humanize.mo,sha256=2l-5qYLpZXG4bn--WH_eCKStUaVHwQ8owWpU626fv_E,3188 +humanize/locale/it_IT/LC_MESSAGES/humanize.po,sha256=hPp_0Li-IIERDMasXr7BRWQixeDR2R5RUvZTHLFURhU,6565 +humanize/locale/ja_JP/LC_MESSAGES/humanize.mo,sha256=QaWCy6xeudjHEhJZmrStFghg-Lax9KC55JbhiG8AFE8,2457 +humanize/locale/ja_JP/LC_MESSAGES/humanize.po,sha256=KEJS3VWc0BupyLag-SVRXv4H7Y6lk8_Kx7eghJJQVUU,6107 +humanize/locale/ko_KR/LC_MESSAGES/humanize.mo,sha256=yDaJCpAY79DonnPJQcx0E8nqjuHJvmlv523Zgw-pjpg,2016 +humanize/locale/ko_KR/LC_MESSAGES/humanize.po,sha256=KyilkPrVkuDWkerBoTcQDkEzetatFoYYe9Q2wGjlp2Q,7019 +humanize/locale/nl_NL/LC_MESSAGES/humanize.mo,sha256=pUzwmGiXcgEgepNqS4KrRLbJnCG2uNdZdfzCu_HFSJw,3258 +humanize/locale/nl_NL/LC_MESSAGES/humanize.po,sha256=OMANrojN8tR5zdwEZywhRwdgo5JtSO3k9507CRhQ5CQ,6604 +humanize/locale/pl_PL/LC_MESSAGES/humanize.mo,sha256=bNeJCcc2gsI3K4_usa_imigYISzGofwsrZ7X7iiC6Pw,3621 +humanize/locale/pl_PL/LC_MESSAGES/humanize.po,sha256=hcGIIqwX9xIuuEW7zwZSjJIXSDxmnG2bG6ABD3w1HKY,7148 +humanize/locale/pt_BR/LC_MESSAGES/humanize.mo,sha256=lElhHaH6FWRwZWit5vs3kQmh5b0bQXYfRY6zqdVXm5U,3184 +humanize/locale/pt_BR/LC_MESSAGES/humanize.po,sha256=WJDyBf3REPuI49q-u6-Hf5KsIdQJELY000HfbtS4eEo,6524 +humanize/locale/pt_PT/LC_MESSAGES/humanize.mo,sha256=AFoTysVc89o2EMopIngkO7vdvYmQE5BmczaWN1sjQI0,3403 +humanize/locale/pt_PT/LC_MESSAGES/humanize.po,sha256=OMgvxGlwlR_xr0-1Hj-tNFKnSpPzihXN7Es1TWCoIyQ,6567 +humanize/locale/ru_RU/LC_MESSAGES/humanize.mo,sha256=i-go1a1XjSR-PpWHBlpOst7DhoY-XlLTDP-paFJ68yY,4538 +humanize/locale/ru_RU/LC_MESSAGES/humanize.po,sha256=38CGjLgWEe8Ci287EZVQbUynVd2nInFvSfBmUBlJ1AA,7906 +humanize/locale/sk_SK/LC_MESSAGES/humanize.mo,sha256=0_mdWYPZhFsPpx5hWEUweV5_MCuIgXJIhE0gBI7qw1Y,3540 +humanize/locale/sk_SK/LC_MESSAGES/humanize.po,sha256=lEKJqzVEMjOeQrE-U_x-g2oOvVPMBq36FVTLxH8Xe5w,7180 +humanize/locale/sl_SI/LC_MESSAGES/humanize.mo,sha256=scf8JQb2OCHRuZLDjaaX4Sta1E1p7ff4XGqXE5GuJP8,3979 +humanize/locale/sl_SI/LC_MESSAGES/humanize.po,sha256=suLp80dryZpMUDWqtm9M6pXFmaojKQKpoPv89UAbMzo,7618 +humanize/locale/sv_SE/LC_MESSAGES/humanize.mo,sha256=Z8Guy6d2Cf2PGW7LFB5FOe4fy3uX5zQCITchn-3t7Ss,3498 +humanize/locale/sv_SE/LC_MESSAGES/humanize.po,sha256=ZB9DAMEWT8MbpC_i-dTSZVZ-n3V67xTft1SDCi3P4Lc,6596 +humanize/locale/tr_TR/LC_MESSAGES/humanize.mo,sha256=fgdMjVbGMQpV1FuMs366OCh4oGAPzdHHWfVGynbQ00E,3151 +humanize/locale/tr_TR/LC_MESSAGES/humanize.po,sha256=hWmHZ1b65Sw0f89JJncRpqPo6IXVD7yXA4lrA37hrg0,6479 +humanize/locale/uk_UA/LC_MESSAGES/humanize.mo,sha256=1Dgq35RkIlF_fUFvV9kayXEZZoD7ceRsViCweUsrZSM,4188 +humanize/locale/uk_UA/LC_MESSAGES/humanize.po,sha256=4bHPUlV0Kc5hFK12wrlMl2PCkW9FWIzgSkxUv0OEXEM,7661 +humanize/locale/vi_VN/LC_MESSAGES/humanize.mo,sha256=qN3hRa5kdPw49HwB4W8aonaiuUDrjyj-CbLswcEUbFQ,3164 +humanize/locale/vi_VN/LC_MESSAGES/humanize.po,sha256=9vvoquJBsPT1Il9W_a6Nh2LL8dvxn_JaBJCM7hwLQeg,6920 +humanize/locale/zh_CN/LC_MESSAGES/humanize.mo,sha256=l5MDM8l9QHK0Q2Y_cpDYZmyklnQAqy-dPSbt8Od5MxM,3011 +humanize/locale/zh_CN/LC_MESSAGES/humanize.po,sha256=nhwY-JtHt-QZctgy_HU-W56qfaTkv6brObpEJu8M9vc,6359 +humanize/locale/zh_HK/LC_MESSAGES/humanize.mo,sha256=nNSSvh4RQ6WXm6aVInM4cIk1zY3PKuUx6r5f7smTW6w,3323 +humanize/locale/zh_HK/LC_MESSAGES/humanize.po,sha256=s7eEhwtRjjRds8LskIzmVqxTAEm7-7aUbk04s3Vp0eE,6495 +humanize/number.py,sha256=E9FdEOrcZ2f5IHVEeZKaFE5NnMm9KT_4TAuZl69zWZE,14489 +humanize/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +humanize/time.py,sha256=8damCbq1kXF-VojBfwPPRZB9JjX0oG4-25y8nTOiS4Y,18278 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/humanize-4.2.2.dist-info/REQUESTED b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/humanize-4.2.2.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/humanize-4.2.2.dist-info/WHEEL b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/humanize-4.2.2.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..becc9a66ea739ba941d48a749e248761cc6e658a --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/humanize-4.2.2.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.37.1) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/humanize-4.2.2.dist-info/top_level.txt b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/humanize-4.2.2.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..38040f732178149f097dbb7e6c27dd50be07c90f --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/humanize-4.2.2.dist-info/top_level.txt @@ -0,0 +1 @@ +humanize diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg/__init__.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ecb1d3c001075d1618fa6dd4824aee0c71ddf1e8 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg/__init__.py @@ -0,0 +1,8 @@ +""" imageio_ffmpeg, FFMPEG wrapper for Python. +""" + +# flake8: noqa + +from ._definitions import __version__ +from ._utils import get_ffmpeg_exe, get_ffmpeg_version +from ._io import count_frames_and_secs, read_frames, write_frames diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg/_definitions.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg/_definitions.py new file mode 100644 index 0000000000000000000000000000000000000000..f450bd09dfb493ca285d601b480de52df81f9859 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg/_definitions.py @@ -0,0 +1,50 @@ +import sys +import struct + +__version__ = "0.4.7" + + +def get_platform(): + bits = struct.calcsize("P") * 8 + if sys.platform.startswith("linux"): + return "linux{}".format(bits) + elif sys.platform.startswith("freebsd"): + return "freebsd{}".format(bits) + elif sys.platform.startswith("win"): + return "win{}".format(bits) + elif sys.platform.startswith("cygwin"): + return "win{}".format(bits) + elif sys.platform.startswith("darwin"): + return "osx{}".format(bits) + else: # pragma: no cover + return None + + +# The Linux static builds (https://johnvansickle.com/ffmpeg/) are build +# for Linux kernels 2.6.32 and up (at the time of writing, ffmpeg v4.1). +# This corresponds to CentOS 6. This means we should use manylinux2010 and not +# manylinux1. +# manylinux1: https://www.python.org/dev/peps/pep-0513 +# manylinux2010: https://www.python.org/dev/peps/pep-0571 + + +# Platform string -> ffmpeg filename +FNAME_PER_PLATFORM = { + "osx64": "ffmpeg-osx64-v4.2.2", # 10.10+ + "win32": "ffmpeg-win32-v4.2.2.exe", # Windows 7+ + "win64": "ffmpeg-win64-v4.2.2.exe", + # "linux32": "ffmpeg-linux32-v4.2.2", + "linux64": "ffmpeg-linux64-v4.2.2", # Kernel 3.2.0+ + "linuxaarch64": "ffmpeg-linuxaarch64-v4.2.2", +} + +osxplats = "macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64" + +# Wheel tag -> platform string +WHEEL_BUILDS = { + "py3-none-manylinux2010_x86_64": "linux64", + "py3-none-manylinux2014_aarch64": "linuxaarch64", + "py3-none-" + osxplats: "osx64", + "py3-none-win32": "win32", + "py3-none-win_amd64": "win64", +} diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg/_io.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg/_io.py new file mode 100644 index 0000000000000000000000000000000000000000..93bc540d6a30b9c0fb9d67cc1c09f4b78dd75c9f --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg/_io.py @@ -0,0 +1,683 @@ +import sys +import time +import pathlib +import subprocess +from functools import lru_cache +from collections import defaultdict + +from ._utils import get_ffmpeg_exe, _popen_kwargs, logger +from ._parsing import LogCatcher, parse_ffmpeg_header, cvsecs + + +ISWIN = sys.platform.startswith("win") + +h264_encoder_preference = defaultdict(lambda: -1) +# The libx264 was the default encoder for a longe time with imageio +h264_encoder_preference["libx264"] = 100 + +# Encoder with the nvidia graphics card dedicated hardware +h264_encoder_preference["h264_nvenc"] = 90 +# Deprecated names for the same encoder +h264_encoder_preference["nvenc_h264"] = 90 +h264_encoder_preference["nvenc"] = 90 + +# vaapi provides hardware encoding with intel integrated graphics chipsets +h264_encoder_preference["h264_vaapi"] = 80 + +# openh264 is cisco's open source encoder +h264_encoder_preference["libopenh264"] = 70 + +h264_encoder_preference["libx264rgb"] = 50 + + +def ffmpeg_test_encoder(encoder): + # Use the null streams to validate if we can encode anything + # https://trac.ffmpeg.org/wiki/Null + cmd = [ + _get_exe(), + "-hide_banner", + "-f", + "lavfi", + "-i", + "nullsrc=s=256x256:d=8", + "-vcodec", + encoder, + "-f", + "null", + "-", + ] + p = subprocess.run( + cmd, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + return p.returncode == 0 + + +def get_compiled_h264_encoders(): + cmd = [_get_exe(), "-hide_banner", "-encoders"] + p = subprocess.run( + cmd, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + stdout = p.stdout.decode().replace("\r", "") + # 2022/04/08: hmaarrfk + # I couldn't find a good way to get the list of available encoders from + # the ffmpeg command + # The ffmpeg command return a table that looks like + # Notice the leading space at the very beginning + # On ubuntu with libffmpeg-nvenc-dev we get + # $ ffmpeg -hide_banner -encoders | grep -i h.264 + # + # Encoders: + # V..... = Video + # A..... = Audio + # S..... = Subtitle + # .F.... = Frame-level multithreading + # ..S... = Slice-level multithreading + # ...X.. = Codec is experimental + # ....B. = Supports draw_horiz_band + # .....D = Supports direct rendering method 1 + # ------ + # V..... libx264 libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264) + # V..... libx264rgb libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB (codec h264) + # V....D h264_nvenc NVIDIA NVENC H.264 encoder (codec h264) + # V..... h264_omx OpenMAX IL H.264 video encoder (codec h264) + # V..... h264_qsv H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (Intel Quick Sync Video acceleration) (codec h264) + # V..... h264_v4l2m2m V4L2 mem2mem H.264 encoder wrapper (codec h264) + # V....D h264_vaapi H.264/AVC (VAAPI) (codec h264) + # V..... nvenc NVIDIA NVENC H.264 encoder (codec h264) + # V..... nvenc_h264 NVIDIA NVENC H.264 encoder (codec h264) + # + # However, just because ffmpeg was compiled with the options enabled + # it doesn't mean that it will be successful + header_footer = stdout.split("------") + footer = header_footer[1].strip("\n") + encoders = [] + for line in footer.split("\n"): + # Strip to remove any leading spaces + line = line.strip() + encoder = line.split(" ")[1] + + if encoder in h264_encoder_preference: + # These encoders are known to support H.264 + # We forcibly include them in case their description changes to + # not include the string "H.264" + encoders.append(encoder) + elif (line[0] == "V") and ("H.264" in line): + encoders.append(encoder) + + encoders.sort(reverse=True, key=lambda x: h264_encoder_preference[x]) + if "h264_nvenc" in encoders: + # Remove deprecated names for the same encoder + for encoder in ["nvenc", "nvenc_h264"]: + if encoder in encoders: + encoders.remove(encoder) + # Return an immutable tuple to avoid users corrupting the lru_cache + return tuple(encoders) + + +@lru_cache() +def get_first_available_h264_encoder(): + compiled_encoders = get_compiled_h264_encoders() + for encoder in compiled_encoders: + if ffmpeg_test_encoder(encoder): + return encoder + else: + raise RuntimeError( + "No valid H.264 encoder was found with the ffmpeg installation" + ) + + +@lru_cache() +def _get_exe(): + return get_ffmpeg_exe() + + +def count_frames_and_secs(path): + """ + Get the number of frames and number of seconds for the given video + file. Note that this operation can be quite slow for large files. + + Disclaimer: I've seen this produce different results from actually reading + the frames with older versions of ffmpeg (2.x). Therefore I cannot say + with 100% certainty that the returned values are always exact. + """ + # https://stackoverflow.com/questions/2017843/fetch-frame-count-with-ffmpeg + + if isinstance(path, pathlib.PurePath): + path = str(path) + if not isinstance(path, str): + raise TypeError("Video path must be a string or pathlib.Path.") + + cmd = [_get_exe(), "-i", path, "-map", "0:v:0", "-c", "copy", "-f", "null", "-"] + try: + out = subprocess.check_output(cmd, stderr=subprocess.STDOUT, **_popen_kwargs()) + except subprocess.CalledProcessError as err: + out = err.output.decode(errors="ignore") + raise RuntimeError("FFMEG call failed with {}:\n{}".format(err.returncode, out)) + + # Note that other than with the subprocess calls below, ffmpeg wont hang here. + # Worst case Python will stop/crash and ffmpeg will continue running until done. + + nframes = nsecs = None + for line in reversed(out.splitlines()): + if line.startswith(b"frame="): + line = line.decode(errors="ignore") + i = line.find("frame=") + if i >= 0: + s = line[i:].split("=", 1)[-1].lstrip().split(" ", 1)[0].strip() + nframes = int(s) + i = line.find("time=") + if i >= 0: + s = line[i:].split("=", 1)[-1].lstrip().split(" ", 1)[0].strip() + nsecs = cvsecs(*s.split(":")) + return nframes, nsecs + + raise RuntimeError("Could not get number of frames") # pragma: no cover + + +def read_frames( + path, + pix_fmt="rgb24", + bpp=None, + input_params=None, + output_params=None, + bits_per_pixel=None, +): + """ + Create a generator to iterate over the frames in a video file. + + It first yields a small metadata dictionary that contains: + + * ffmpeg_version: the ffmpeg version in use (as a string). + * codec: a hint about the codec used to encode the video, e.g. "h264". + * source_size: the width and height of the encoded video frames. + * size: the width and height of the frames that will be produced. + * fps: the frames per second. Can be zero if it could not be detected. + * duration: duration in seconds. Can be zero if it could not be detected. + + After that, it yields frames until the end of the video is reached. Each + frame is a bytes object. + + This function makes no assumptions about the number of frames in + the data. For one because this is hard to predict exactly, but also + because it may depend on the provided output_params. If you want + to know the number of frames in a video file, use count_frames_and_secs(). + It is also possible to estimate the number of frames from the fps and + duration, but note that even if both numbers are present, the resulting + value is not always correct. + + Example: + + gen = read_frames(path) + meta = gen.__next__() + for frame in gen: + print(len(frame)) + + Parameters: + path (str): the filename of the file to read from. + pix_fmt (str): the pixel format of the frames to be read. + The default is "rgb24" (frames are uint8 RGB images). + input_params (list): Additional ffmpeg input command line parameters. + output_params (list): Additional ffmpeg output command line parameters. + bits_per_pixel (int): The number of bits per pixel in the output frames. + This depends on the given pix_fmt. Default is 24 (RGB) + bpp (int): DEPRECATED, USE bits_per_pixel INSTEAD. The number of bytes per pixel in the output frames. + This depends on the given pix_fmt. Some pixel formats like yuv420p have 12 bits per pixel + and cannot be set in bytes as integer. For this reason the bpp argument is deprecated. + """ + + # ----- Input args + + if isinstance(path, pathlib.PurePath): + path = str(path) + if not isinstance(path, str): + raise TypeError("Video path must be a string or pathlib.Path.") + # Note: Dont check whether it exists. The source could be e.g. a camera. + + pix_fmt = pix_fmt or "rgb24" + bpp = bpp or 3 + bits_per_pixel = bits_per_pixel or bpp * 8 + input_params = input_params or [] + output_params = output_params or [] + + assert isinstance(pix_fmt, str), "pix_fmt must be a string" + assert isinstance(bits_per_pixel, int), "bpp and bits_per_pixel must be an int" + assert isinstance(input_params, list), "input_params must be a list" + assert isinstance(output_params, list), "output_params must be a list" + + # ----- Prepare + + pre_output_params = ["-pix_fmt", pix_fmt, "-vcodec", "rawvideo", "-f", "image2pipe"] + + cmd = [_get_exe()] + cmd += input_params + ["-i", path] + cmd += pre_output_params + output_params + ["-"] + + p = subprocess.Popen( + cmd, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + **_popen_kwargs(prevent_sigint=True) + ) + + log_catcher = LogCatcher(p.stderr) + + # Init policy by which to terminate ffmpeg. May be set to "kill" later. + stop_policy = "timeout" # not wait; ffmpeg should be able to quit quickly + + # Enter try block directly after opening the process. + # We terminate ffmpeg in the finally clause. + # Generators are automatically closed when they get deleted, + # so the finally block is guaranteed to run. + try: + + # ----- Load meta data + + # Wait for the log catcher to get the meta information + etime = time.time() + 10.0 + while log_catcher.is_alive() and not log_catcher.header and time.time() < etime: + time.sleep(0.01) + + # Check whether we have the information + if not log_catcher.header: + err2 = log_catcher.get_text(0.2) + fmt = "Could not load meta information\n=== stderr ===\n{}" + raise IOError(fmt.format(err2)) + elif "No such file or directory" in log_catcher.header: + raise IOError("{} not found! Wrong path?".format(path)) + + meta = parse_ffmpeg_header(log_catcher.header) + yield meta + + # ----- Read frames + + w, h = meta["size"] + framesize_bits = w * h * bits_per_pixel + framesize_bytes = framesize_bits / 8 + assert ( + framesize_bytes.is_integer() + ), "incorrect bits_per_pixel, framesize in bytes must be an int" + framesize_bytes = int(framesize_bytes) + framenr = 0 + + while True: + framenr += 1 + try: + bb = bytes() + while len(bb) < framesize_bytes: + extra_bytes = p.stdout.read(framesize_bytes - len(bb)) + if not extra_bytes: + if len(bb) == 0: + return + else: + raise RuntimeError( + "End of file reached before full frame could be read." + ) + bb += extra_bytes + yield bb + except Exception as err: + err1 = str(err) + err2 = log_catcher.get_text(0.4) + fmt = "Could not read frame {}:\n{}\n=== stderr ===\n{}" + raise RuntimeError(fmt.format(framenr, err1, err2)) + + except GeneratorExit: + # Note that GeneratorExit does not inherit from Exception but BaseException + pass + + except Exception: + # Normal exceptions fall through + raise + + except BaseException: + # Detect KeyboardInterrupt / SystemExit: don't wait for ffmpeg to quit + stop_policy = "kill" + raise + + finally: + # Stop the LogCatcher thread, which reads from stderr. + log_catcher.stop_me() + + # Make sure that ffmpeg is terminated. + if p.poll() is None: + + # Ask ffmpeg to quit + try: + # I read somewhere that modern ffmpeg on Linux prefers a + # "ctrl-c", but tests so far suggests sending q is more robust. + # > p.send_signal(signal.SIGINT) + # Sending q via communicate works, but can hang (see #17) + # > p.communicate(b"q") + # So let's do similar to what communicate does, but without + # reading stdout (which may block). It looks like only closing + # stdout is enough (tried Windows+Linux), but let's play safe. + # Found that writing to stdin can cause "Invalid argument" on + # Windows # and "Broken Pipe" on Unix. + # p.stdin.write(b"q") # commented out in v0.4.1 + p.stdout.close() + p.stdin.close() + # p.stderr.close() -> not here, the log_catcher closes it + except Exception as err: # pragma: no cover + logger.warning("Error while attempting stop ffmpeg (r): " + str(err)) + + if stop_policy == "timeout": + # Wait until timeout, produce a warning and kill if it still exists + try: + etime = time.time() + 1.5 + while time.time() < etime and p.poll() is None: + time.sleep(0.01) + finally: + if p.poll() is None: # pragma: no cover + logger.warning("We had to kill ffmpeg to stop it.") + p.kill() + + else: # stop_policy == "kill" + # Just kill it + p.kill() + + +def write_frames( + path, + size, + pix_fmt_in="rgb24", + pix_fmt_out="yuv420p", + fps=16, + quality=5, + bitrate=None, + codec=None, + macro_block_size=16, + ffmpeg_log_level="warning", + ffmpeg_timeout=None, + input_params=None, + output_params=None, + audio_path=None, + audio_codec=None, +): + """ + Create a generator to write frames (bytes objects) into a video file. + + The frames are written by using the generator's `send()` method. Frames + can be anything that can be written to a file. Typically these are + bytes objects, but c-contiguous Numpy arrays also work. + + Example: + + gen = write_frames(path, size) + gen.send(None) # seed the generator + for frame in frames: + gen.send(frame) + gen.close() # don't forget this + + Parameters: + path (str): the filename to write to. + size (tuple): the width and height of the frames. + pix_fmt_in (str): the pixel format of incoming frames. + E.g. "gray", "gray8a", "rgb24", or "rgba". Default "rgb24". + pix_fmt_out (str): the pixel format to store frames. Default yuv420p". + fps (float): The frames per second. Default 16. + quality (float): A measure for quality between 0 and 10. Default 5. + Ignored if bitrate is given. + bitrate (str): The bitrate, e.g. "192k". The defaults are pretty good. + codec (str): The codec. Default "libx264" for .mp4 (if available from + the ffmpeg executable) or "msmpeg4" for .wmv. + macro_block_size (int): You probably want to align the size of frames + to this value to avoid image resizing. Default 16. Can be set + to 1 to avoid block alignment, though this is not recommended. + ffmpeg_log_level (str): The ffmpeg logging level. Default "warning". + ffmpeg_timeout (float): Timeout in seconds to wait for ffmpeg process + to finish. Value of 0 or None will wait forever (default). The time that + ffmpeg needs depends on CPU speed, compression, and frame size. + input_params (list): Additional ffmpeg input command line parameters. + output_params (list): Additional ffmpeg output command line parameters. + audio_path (str): A input file path for encoding with an audio stream. + Default None, no audio. + audio_codec (str): The audio codec to use if audio_path is provided. + "copy" will try to use audio_path's audio codec without re-encoding. + Default None, but some formats must have certain codecs specified. + """ + + # ----- Input args + + if isinstance(path, pathlib.PurePath): + path = str(path) + if not isinstance(path, str): + raise TypeError("Video path must be a string or pathlib.Path.") + + # The pix_fmt_out yuv420p is the best for the outpur to work in + # QuickTime and most other players. These players only support + # the YUV planar color space with 4:2:0 chroma subsampling for + # H.264 video. Otherwise, depending on the source, ffmpeg may + # output to a pixel format that may be incompatible with these + # players. See https://trac.ffmpeg.org/wiki/Encode/H.264#Encodingfordumbplayers + + pix_fmt_in = pix_fmt_in or "rgb24" + pix_fmt_out = pix_fmt_out or "yuv420p" + fps = fps or 16 + # bitrate, codec, macro_block_size can all be None or ... + macro_block_size = macro_block_size or 16 + ffmpeg_log_level = ffmpeg_log_level or "warning" + input_params = input_params or [] + output_params = output_params or [] + ffmpeg_timeout = ffmpeg_timeout or 0 + + floatish = float, int + if isinstance(size, (tuple, list)): + assert len(size) == 2, "size must be a 2-tuple" + assert isinstance(size[0], int) and isinstance( + size[1], int + ), "size must be ints" + sizestr = "{:d}x{:d}".format(*size) + # elif isinstance(size, str): + # assert "x" in size, "size as string must have format NxM" + # sizestr = size + else: + assert False, "size must be str or tuple" + assert isinstance(pix_fmt_in, str), "pix_fmt_in must be str" + assert isinstance(pix_fmt_out, str), "pix_fmt_out must be str" + assert isinstance(fps, floatish), "fps must be float" + if quality is not None: + assert isinstance(quality, floatish), "quality must be float" + assert 1 <= quality <= 10, "quality must be between 1 and 10 inclusive" + assert isinstance(macro_block_size, int), "macro_block_size must be int" + assert isinstance(ffmpeg_log_level, str), "ffmpeg_log_level must be str" + assert isinstance(ffmpeg_timeout, floatish), "ffmpeg_timeout must be float" + assert isinstance(input_params, list), "input_params must be a list" + assert isinstance(output_params, list), "output_params must be a list" + + # ----- Prepare + + # Get parameters + if not codec: + if path.lower().endswith(".wmv"): + # This is a safer default codec on windows to get videos that + # will play in powerpoint and other apps. H264 is not always + # available on windows. + codec = "msmpeg4" + else: + codec = get_first_available_h264_encoder() + + audio_params = ["-an"] + if audio_path is not None and not path.lower().endswith(".gif"): + audio_params = ["-i", audio_path] + if audio_codec is not None: + output_params += ["-acodec", audio_codec] + output_params += ["-map", "0:v:0", "-map", "1:a:0"] + + # Get command + cmd = [_get_exe(), "-y", "-f", "rawvideo", "-vcodec", "rawvideo", "-s", sizestr] + cmd += ["-pix_fmt", pix_fmt_in, "-r", "{:.02f}".format(fps)] + input_params + cmd += ["-i", "-"] + audio_params + cmd += ["-vcodec", codec, "-pix_fmt", pix_fmt_out] + + # Add fixed bitrate or variable bitrate compression flags + if bitrate is not None: + cmd += ["-b:v", str(bitrate)] + elif quality is not None: # If None, then we don't add anything + quality = 1 - quality / 10.0 + if codec == "libx264": + # crf ranges 0 to 51, 51 being worst. + quality = int(quality * 51) + cmd += ["-crf", str(quality)] # for h264 + else: # Many codecs accept q:v + # q:v range can vary, 1-31, 31 being worst + # But q:v does not always have the same range. + # May need a way to find range for any codec. + quality = int(quality * 30) + 1 + cmd += ["-qscale:v", str(quality)] # for others + + # Note, for most codecs, the image dimensions must be divisible by + # 16 the default for the macro_block_size is 16. Check if image is + # divisible, if not have ffmpeg upsize to nearest size and warn + # user they should correct input image if this is not desired. + if macro_block_size > 1: + if size[0] % macro_block_size > 0 or size[1] % macro_block_size > 0: + out_w = size[0] + out_h = size[1] + if size[0] % macro_block_size > 0: + out_w += macro_block_size - (size[0] % macro_block_size) + if size[1] % macro_block_size > 0: + out_h += macro_block_size - (size[1] % macro_block_size) + cmd += ["-vf", "scale={}:{}".format(out_w, out_h)] + logger.warning( + "IMAGEIO FFMPEG_WRITER WARNING: input image is not" + " divisible by macro_block_size={}, resizing from {} " + "to {} to ensure video compatibility with most codecs " + "and players. To prevent resizing, make your input " + "image divisible by the macro_block_size or set the " + "macro_block_size to 1 (risking incompatibility).".format( + macro_block_size, size[:2], (out_w, out_h) + ) + ) + + # Rather than redirect stderr to a pipe, just set minimal + # output from ffmpeg by default. That way if there are warnings + # the user will see them. + cmd += ["-v", ffmpeg_log_level] + cmd += output_params + cmd.append(path) + cmd_str = " ".join(cmd) + if any( + [level in ffmpeg_log_level for level in ("info", "verbose", "debug", "trace")] + ): + logger.info("RUNNING FFMPEG COMMAND: " + cmd_str) + + # Launch process + p = subprocess.Popen( + cmd, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=None, + **_popen_kwargs(prevent_sigint=True) + ) + + # Note that directing stderr to a pipe on windows will cause ffmpeg + # to hang if the buffer is not periodically cleared using + # StreamCatcher or other means. + # Setting bufsize to 0 or a small value does not seem to have much effect + # (tried on Windows and Linux). I suspect that ffmpeg buffers + # multiple frames (before encoding in a batch). + + # Init policy by which to terminate ffmpeg. May be set to "kill" later. + stop_policy = "timeout" + if not ffmpeg_timeout: + stop_policy = "wait" + + # ----- Write frames + + # Enter try block directly after opening the process. + # We terminate ffmpeg in the finally clause. + # Generators are automatically closed when they get deleted, + # so the finally block is guaranteed to run. + try: + + # Just keep going until the generator.close() is called (raises GeneratorExit). + # This could also happen when the generator is deleted somehow. + nframes = 0 + while True: + + # Get frame + bb = yield + + # framesize = size[0] * size[1] * depth * bpp + # assert isinstance(bb, bytes), "Frame must be send as bytes" + # assert len(bb) == framesize, "Frame must have width*height*depth*bpp bytes" + # Actually, we accept anything that can be written to file. + # This e.g. allows writing numpy arrays without having to make a copy ... + + # Write + try: + p.stdin.write(bb) + except Exception as err: + # Show the command and stderr from pipe + msg = ( + "{0:}\n\nFFMPEG COMMAND:\n{1:}\n\nFFMPEG STDERR " + "OUTPUT:\n".format(err, cmd_str) + ) + raise IOError(msg) + + nframes += 1 + + except GeneratorExit: + # Note that GeneratorExit does not inherit from Exception but BaseException + # Detect premature closing + if nframes == 0: + logger.warning("No frames have been written; the written video is invalid.") + + except Exception: + # Normal exceptions fall through + raise + + except BaseException: + # Detect KeyboardInterrupt / SystemExit: don't wait for ffmpeg to quit + stop_policy = "kill" + raise + + finally: + + # Make sure that ffmpeg is terminated. + if p.poll() is None: + + # Tell ffmpeg that we're done + try: + p.stdin.close() + except Exception as err: # pragma: no cover + logger.warning("Error while attempting stop ffmpeg (w): " + str(err)) + + if stop_policy == "timeout": + # Wait until timeout, produce a warning and kill if it still exists + try: + etime = time.time() + ffmpeg_timeout + while (time.time() < etime) and p.poll() is None: + time.sleep(0.01) + finally: + if p.poll() is None: # pragma: no cover + logger.warning( + "We had to kill ffmpeg to stop it. " + + "Consider increasing ffmpeg_timeout, " + + "or setting it to zero (no timeout)." + ) + p.kill() + + elif stop_policy == "wait": + # Wait forever, kill if it if we're interrupted + try: + while p.poll() is None: + time.sleep(0.01) + finally: # the above can raise e.g. by ctrl-c or systemexit + if p.poll() is None: # pragma: no cover + p.kill() + + else: # stop_policy == "kill": + # Just kill it + p.kill() + # Just to be safe, wrap in try/except + try: + p.stdout.close() + except Exception: + pass diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg/_parsing.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg/_parsing.py new file mode 100644 index 0000000000000000000000000000000000000000..2b75228be3d325dd018436ba8181ab49953e86f0 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg/_parsing.py @@ -0,0 +1,201 @@ +import re +import time +import threading + +from ._utils import logger + + +class LogCatcher(threading.Thread): + """Thread to keep reading from stderr so that the buffer does not + fill up and stalls the ffmpeg process. On stderr a message is send + on every few frames with some meta information. We only keep the + last ones. + """ + + def __init__(self, file): + self._file = file + self._header = "" + self._lines = [] + self._remainder = b"" + threading.Thread.__init__(self) + self.daemon = True # do not let this thread hold up Python shutdown + self._should_stop = False + self.start() + + def stop_me(self): + self._should_stop = True + + @property + def header(self): + """Get header text. Empty string if the header is not yet parsed.""" + return self._header + + def get_text(self, timeout=0): + """Get the whole text written to stderr so far. To preserve + memory, only the last 50 to 100 frames are kept. + + If a timeout is given, wait for this thread to finish. When + something goes wrong, we stop ffmpeg and want a full report of + stderr, but this thread might need a tiny bit more time. + """ + + # Wait? + if timeout > 0: + etime = time.time() + timeout + while self.is_alive() and time.time() < etime: # pragma: no cover + time.sleep(0.01) + # Return str + lines = b"\n".join(self._lines) + return self._header + "\n" + lines.decode("utf-8", "ignore") + + def run(self): + + # Create ref here so it still exists even if Py is shutting down + limit_lines_local = limit_lines + + while not self._should_stop: + time.sleep(0) + # Read one line. Detect when closed, and exit + try: + line = self._file.read(20) + except ValueError: # pragma: no cover + break + if not line: + break + # Process to divide in lines + line = line.replace(b"\r", b"\n").replace(b"\n\n", b"\n") + lines = line.split(b"\n") + lines[0] = self._remainder + lines[0] + self._remainder = lines.pop(-1) + # Process each line + self._lines.extend(lines) + if not self._header: + if get_output_video_line(self._lines): + header = b"\n".join(self._lines) + self._header += header.decode("utf-8", "ignore") + elif self._lines: + self._lines = limit_lines_local(self._lines) + + # Close the file when we're done + # See #61 and #69 + try: + self._file.close() + except Exception: + pass + + +def get_output_video_line(lines): + """Get the line that defines the video stream that ffmpeg outputs, + and which we read. + """ + in_output = False + for line in lines: + sline = line.lstrip() + if sline.startswith(b"Output "): + in_output = True + elif in_output: + if sline.startswith(b"Stream ") and b" Video:" in sline: + return line + + +def limit_lines(lines, N=32): + """When number of lines > 2*N, reduce to N.""" + if len(lines) > 2 * N: + lines = [b"... showing only last few lines ..."] + lines[-N:] + return lines + + +def cvsecs(*args): + """converts a time to second. Either cvsecs(min, secs) or + cvsecs(hours, mins, secs). + """ + if len(args) == 1: + return float(args[0]) + elif len(args) == 2: + return 60 * float(args[0]) + float(args[1]) + elif len(args) == 3: + return 3600 * float(args[0]) + 60 * float(args[1]) + float(args[2]) + + +def parse_ffmpeg_header(text): + lines = text.splitlines() + meta = {} + + # meta["header"] = text # Can enable this for debugging + + # Get version + ver = lines[0].split("version", 1)[-1].split("Copyright")[0] + meta["ffmpeg_version"] = ver.strip() + " " + lines[1].strip() + + # get the output line that speaks about video + videolines = [ + l for l in lines if l.lstrip().startswith("Stream ") and " Video: " in l + ] + + # Codec and pix_fmt hint + line = videolines[0] + meta["codec"] = line.split("Video: ", 1)[-1].lstrip().split(" ", 1)[0].strip() + meta["pix_fmt"] = line.split("Video: ", 1)[-1].split(",")[1].strip() + + # get the output line that speaks about audio + audiolines = [ + l for l in lines if l.lstrip().startswith("Stream ") and " Audio: " in l + ] + + if len(audiolines) > 0: + audio_line = audiolines[0] + meta["audio_codec"] = ( + audio_line.split("Audio: ", 1)[-1].lstrip().split(" ", 1)[0].strip() + ) + + # get the frame rate. + # matches can be empty, see #171, assume nframes = inf + # the regexp omits values of "1k tbr" which seems a specific edge-case #262 + # it seems that tbr is generally to be preferred #262 + fps = 0 + for line in (videolines[0], videolines[-1]): + matches = re.findall(r" ([0-9]+\.?[0-9]*) (tbr|fps)", line) + matches.sort(key=lambda x: x[1] == "tbr", reverse=True) + if matches: + fps = float(matches[0][0].strip()) + meta["fps"] = fps + + # get the size of the original stream, of the form 460x320 (w x h) + line = videolines[0] + match = re.search(" [0-9]*x[0-9]*(,| )", line) + parts = line[match.start() : match.end() - 1].split("x") + meta["source_size"] = tuple(map(int, parts)) + + # get the size of what we receive, of the form 460x320 (w x h) + line = videolines[-1] # Pipe output + match = re.search(" [0-9]*x[0-9]*(,| )", line) + parts = line[match.start() : match.end() - 1].split("x") + meta["size"] = tuple(map(int, parts)) + + # Check the two sizes + if meta["source_size"] != meta["size"]: + logger.warning( + "The frame size for reading {} is " + "different from the source frame size {}.".format( + meta["size"], meta["source_size"] + ) + ) + + # get the rotate metadata + reo_rotate = re.compile("rotate\s+:\s([0-9]+)") + match = reo_rotate.search(text) + rotate = 0 + if match is not None: + rotate = match.groups()[0] + meta["rotate"] = int(rotate) + + # get duration (in seconds) + line = [l for l in lines if "Duration: " in l][0] + match = re.search(" [0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9]", line) + duration = 0 + if match is not None: + hms = line[match.start() + 1 : match.end()].split(":") + duration = cvsecs(*hms) + meta["duration"] = duration + + return meta diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg/_utils.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg/_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..27e42088dd244710fbe770fb537bc533c1fa5ec1 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg/_utils.py @@ -0,0 +1,105 @@ +import os +import sys +import logging +import subprocess +from pkg_resources import resource_filename + +from ._definitions import get_platform, FNAME_PER_PLATFORM + +logger = logging.getLogger("imageio_ffmpeg") + + +def get_ffmpeg_exe(): + """ + Get the ffmpeg executable file. This can be the binary defined by + the IMAGEIO_FFMPEG_EXE environment variable, the binary distributed + with imageio-ffmpeg, an ffmpeg binary installed with conda, or the + system ffmpeg (in that order). A RuntimeError is raised if no valid + ffmpeg could be found. + """ + + # 1. Try environment variable. - Dont test it: the user is explicit here! + exe = os.getenv("IMAGEIO_FFMPEG_EXE", None) + if exe: + return exe + + plat = get_platform() + + # 2. Try from here + bin_dir = resource_filename("imageio_ffmpeg", "binaries") + exe = os.path.join(bin_dir, FNAME_PER_PLATFORM.get(plat, "")) + if exe and os.path.isfile(exe) and _is_valid_exe(exe): + return exe + + # 3. Try binary from conda package + # (installed e.g. via `conda install ffmpeg -c conda-forge`) + if plat.startswith("win"): + exe = os.path.join(sys.prefix, "Library", "bin", "ffmpeg.exe") + else: + exe = os.path.join(sys.prefix, "bin", "ffmpeg") + if exe and os.path.isfile(exe) and _is_valid_exe(exe): + return exe + + # 4. Try system ffmpeg command + exe = "ffmpeg" + if _is_valid_exe(exe): + return exe + + # Nothing was found + raise RuntimeError( + "No ffmpeg exe could be found. Install ffmpeg on your system, " + "or set the IMAGEIO_FFMPEG_EXE environment variable." + ) + + +def _popen_kwargs(prevent_sigint=False): + startupinfo = None + preexec_fn = None + creationflags = 0 + if sys.platform.startswith("win"): + # Stops executable from flashing on Windows (see #22) + startupinfo = subprocess.STARTUPINFO() + startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW + if prevent_sigint: + # Prevent propagation of sigint (see #4) + # https://stackoverflow.com/questions/5045771 + if sys.platform.startswith("win"): + creationflags = 0x00000200 + else: + preexec_fn = os.setpgrp # the _pre_exec does not seem to work + + falsy = ("", "0", "false", "no") + if os.getenv("IMAGEIO_FFMPEG_NO_PREVENT_SIGINT", "").lower() not in falsy: + # Unset preexec_fn to work around a strange hang on fork() (see #58) + preexec_fn = None + + return { + "startupinfo": startupinfo, + "creationflags": creationflags, + "preexec_fn": preexec_fn, + } + + +def _is_valid_exe(exe): + cmd = [exe, "-version"] + try: + with open(os.devnull, "w") as null: + subprocess.check_call( + cmd, stdout=null, stderr=subprocess.STDOUT, **_popen_kwargs() + ) + return True + except (OSError, ValueError, subprocess.CalledProcessError): + return False + + +def get_ffmpeg_version(): + """ + Get the version of the used ffmpeg executable (as a string). + """ + exe = get_ffmpeg_exe() + line = subprocess.check_output([exe, "-version"], **_popen_kwargs()).split( + b"\n", 1 + )[0] + line = line.decode(errors="ignore").strip() + version = line.split("version", 1)[-1].lstrip().split(" ", 1)[0].strip() + return version diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/INSTALLER b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/LICENSE-3RD-PARTY.txt b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/LICENSE-3RD-PARTY.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7d91a4fbac03d048f9211dd87fa62471d6d77ec --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/LICENSE-3RD-PARTY.txt @@ -0,0 +1,3065 @@ +OpenCV library is redistributed within opencv-python package. +This license applies to OpenCV binary in the directory cv2/. + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +------------------------------------------------------------------------------ +libvpx is redistributed within all opencv-python Linux packages. +This license applies to libvpx binary in the directory cv2/. + +Copyright (c) 2010, The WebM Project authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google, nor the WebM Project, nor the names + of its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ +FFmpeg is redistributed within all opencv-python packages. + +Libbluray, libgnutls, libnettle, libhogweed, libintl, libmp3lame, libp11, +librtmp, libsoxr and libtasn1 are redistributed within all opencv-python macOS packages. + +This license applies to the above library binaries in the directory cv2/. + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + +------------------------------------------------------------------------------ +Qt 5 is redistributed within non-headless opencv-python Linux and macOS packages. +libgmp is redistributed within opencv-python macOS packages. +libidn2 is redistributed within opencv-python macOS packages. +libunistring is redistributed within opencv-python macOS packages. +This license applies to the above binaries in the directory cv2/. + + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. + +------------------------------------------------------------------------------ +bzip2 is redistributed within all opencv-python Linux packages. +This license applies to libbz2 binary in the directory cv2/. + +This program, "bzip2", the associated library "libbzip2", and all +documentation, are copyright (C) 1996-2010 Julian R Seward. All +rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + +3. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + +4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Julian Seward, jseward@bzip.org +bzip2/libbzip2 version 1.0.6 of 6 September 2010 + +------------------------------------------------------------------------------ +libcrypto and libssl are redistributed within all opencv-python Linux and macOS packages. +libopencore-amrnb and libopencore-amrwb are redistributed within all opencv-python Linux and macOS packages. +This license applies to above binaries in the directory cv2/. + + LICENSE ISSUES + ============== + + The OpenSSL toolkit stays under a double license, i.e. both the conditions of + the OpenSSL License and the original SSLeay license apply to the toolkit. + See below for the actual license texts. + + OpenSSL License + --------------- + +/* ==================================================================== + * Copyright (c) 1998-2019 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + + Original SSLeay License + ----------------------- + +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are adhered to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the routines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publicly available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +------------------------------------------------------------------------------ +libfontconfig is redistributed within all opencv-python macOS packages. +This license applies to libfontconfig binary in the directory cv2/. + +Copyright © 2000,2001,2002,2003,2004,2006,2007 Keith Packard +Copyright © 2005 Patrick Lam +Copyright © 2009 Roozbeh Pournader +Copyright © 2008,2009 Red Hat, Inc. +Copyright © 2008 Danilo Šegan +Copyright © 2012 Google, Inc. + + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation, and that the name of the author(s) not be used in +advertising or publicity pertaining to distribution of the software without +specific, written prior permission. The authors make no +representations about the suitability of this software for any purpose. It +is provided "as is" without express or implied warranty. + +THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +------------------------------------------------------------------------------ +libfreetype is redistributed within opencv-python Linux and macOS packages. +This license applies to libfreetype binary in the directory cv2/. + + The FreeType Project LICENSE + ---------------------------- + + 2006-Jan-27 + + Copyright 1996-2002, 2006 by + David Turner, Robert Wilhelm, and Werner Lemberg + + + +Introduction +============ + + The FreeType Project is distributed in several archive packages; + some of them may contain, in addition to the FreeType font engine, + various tools and contributions which rely on, or relate to, the + FreeType Project. + + This license applies to all files found in such packages, and + which do not fall under their own explicit license. The license + affects thus the FreeType font engine, the test programs, + documentation and makefiles, at the very least. + + This license was inspired by the BSD, Artistic, and IJG + (Independent JPEG Group) licenses, which all encourage inclusion + and use of free software in commercial and freeware products + alike. As a consequence, its main points are that: + + o We don't promise that this software works. However, we will be + interested in any kind of bug reports. (`as is' distribution) + + o You can use this software for whatever you want, in parts or + full form, without having to pay us. (`royalty-free' usage) + + o You may not pretend that you wrote this software. If you use + it, or only parts of it, in a program, you must acknowledge + somewhere in your documentation that you have used the + FreeType code. (`credits') + + We specifically permit and encourage the inclusion of this + software, with or without modifications, in commercial products. + We disclaim all warranties covering The FreeType Project and + assume no liability related to The FreeType Project. + + + Finally, many people asked us for a preferred form for a + credit/disclaimer to use in compliance with this license. We thus + encourage you to use the following text: + + """ + Portions of this software are copyright © The FreeType + Project (www.freetype.org). All rights reserved. + """ + + Please replace with the value from the FreeType version you + actually use. + + +Legal Terms +=========== + +0. Definitions +-------------- + + Throughout this license, the terms `package', `FreeType Project', + and `FreeType archive' refer to the set of files originally + distributed by the authors (David Turner, Robert Wilhelm, and + Werner Lemberg) as the `FreeType Project', be they named as alpha, + beta or final release. + + `You' refers to the licensee, or person using the project, where + `using' is a generic term including compiling the project's source + code as well as linking it to form a `program' or `executable'. + This program is referred to as `a program using the FreeType + engine'. + + This license applies to all files distributed in the original + FreeType Project, including all source code, binaries and + documentation, unless otherwise stated in the file in its + original, unmodified form as distributed in the original archive. + If you are unsure whether or not a particular file is covered by + this license, you must contact us to verify this. + + The FreeType Project is copyright (C) 1996-2000 by David Turner, + Robert Wilhelm, and Werner Lemberg. All rights reserved except as + specified below. + +1. No Warranty +-------------- + + THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO + USE, OF THE FREETYPE PROJECT. + +2. Redistribution +----------------- + + This license grants a worldwide, royalty-free, perpetual and + irrevocable right and license to use, execute, perform, compile, + display, copy, create derivative works of, distribute and + sublicense the FreeType Project (in both source and object code + forms) and derivative works thereof for any purpose; and to + authorize others to exercise some or all of the rights granted + herein, subject to the following conditions: + + o Redistribution of source code must retain this license file + (`FTL.TXT') unaltered; any additions, deletions or changes to + the original files must be clearly indicated in accompanying + documentation. The copyright notices of the unaltered, + original files must be preserved in all copies of source + files. + + o Redistribution in binary form must provide a disclaimer that + states that the software is based in part of the work of the + FreeType Team, in the distribution documentation. We also + encourage you to put an URL to the FreeType web page in your + documentation, though this isn't mandatory. + + These conditions apply to any software derived from or based on + the FreeType Project, not just the unmodified files. If you use + our work, you must acknowledge us. However, no fee need be paid + to us. + +3. Advertising +-------------- + + Neither the FreeType authors and contributors nor you shall use + the name of the other for commercial, advertising, or promotional + purposes without specific prior written permission. + + We suggest, but do not require, that you use one or more of the + following phrases to refer to this software in your documentation + or advertising materials: `FreeType Project', `FreeType Engine', + `FreeType library', or `FreeType Distribution'. + + As you have not signed this license, you are not required to + accept it. However, as the FreeType Project is copyrighted + material, only this license, or another one contracted with the + authors, grants you the right to use, distribute, and modify it. + Therefore, by using, distributing, or modifying the FreeType + Project, you indicate that you understand and accept all the terms + of this license. + +4. Contacts +----------- + + There are two mailing lists related to FreeType: + + o freetype@nongnu.org + + Discusses general use and applications of FreeType, as well as + future and wanted additions to the library and distribution. + If you are looking for support, start in this list if you + haven't found anything to help you in the documentation. + + o freetype-devel@nongnu.org + + Discusses bugs, as well as engine internals, design issues, + specific licenses, porting, etc. + + Our home page can be found at + + https://www.freetype.org + +------------------------------------------------------------------------------ +libpng is redistributed within all opencv-python Linux and macOS packages. +This license applies to libpng binary in the directory cv2/. + +PNG Reference Library License version 2 +--------------------------------------- + + * Copyright (c) 1995-2019 The PNG Reference Library Authors. + * Copyright (c) 2018-2019 Cosmin Truta. + * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. + * Copyright (c) 1996-1997 Andreas Dilger. + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. + +The software is supplied "as is", without warranty of any kind, +express or implied, including, without limitation, the warranties +of merchantability, fitness for a particular purpose, title, and +non-infringement. In no event shall the Copyright owners, or +anyone distributing the software, be liable for any damages or +other liability, whether in contract, tort or otherwise, arising +from, out of, or in connection with the software, or the use or +other dealings in the software, even if advised of the possibility +of such damage. + +Permission is hereby granted to use, copy, modify, and distribute +this software, or portions hereof, for any purpose, without fee, +subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you + must not claim that you wrote the original software. If you + use this software in a product, an acknowledgment in the product + documentation would be appreciated, but is not required. + + 2. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + + +PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35) +----------------------------------------------------------------------- + +libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are +Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are +derived from libpng-1.0.6, and are distributed according to the same +disclaimer and license as libpng-1.0.6 with the following individuals +added to the list of Contributing Authors: + + Simon-Pierre Cadieux + Eric S. Raymond + Mans Rullgard + Cosmin Truta + Gilles Vollant + James Yu + Mandar Sahastrabuddhe + Google Inc. + Vadim Barkov + +and with the following additions to the disclaimer: + + There is no warranty against interference with your enjoyment of + the library or against infringement. There is no warranty that our + efforts or the library will fulfill any of your particular purposes + or needs. This library is provided with all faults, and the entire + risk of satisfactory quality, performance, accuracy, and effort is + with the user. + +Some files in the "contrib" directory and some configure-generated +files that are distributed with libpng have other copyright owners, and +are released under other open source licenses. + +libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are +Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from +libpng-0.96, and are distributed according to the same disclaimer and +license as libpng-0.96, with the following individuals added to the +list of Contributing Authors: + + Tom Lane + Glenn Randers-Pehrson + Willem van Schaik + +libpng versions 0.89, June 1996, through 0.96, May 1997, are +Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, +and are distributed according to the same disclaimer and license as +libpng-0.88, with the following individuals added to the list of +Contributing Authors: + + John Bowler + Kevin Bracey + Sam Bushell + Magnus Holmgren + Greg Roelofs + Tom Tanner + +Some files in the "scripts" directory have other copyright owners, +but are released under this license. + +libpng versions 0.5, May 1995, through 0.88, January 1996, are +Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. + +For the purposes of this copyright and license, "Contributing Authors" +is defined as the following set of individuals: + + Andreas Dilger + Dave Martindale + Guy Eric Schalnat + Paul Schmidt + Tim Wegner + +The PNG Reference Library is supplied "AS IS". The Contributing +Authors and Group 42, Inc. disclaim all warranties, expressed or +implied, including, without limitation, the warranties of +merchantability and of fitness for any purpose. The Contributing +Authors and Group 42, Inc. assume no liability for direct, indirect, +incidental, special, exemplary, or consequential damages, which may +result from the use of the PNG Reference Library, even if advised of +the possibility of such damage. + +Permission is hereby granted to use, copy, modify, and distribute this +source code, or portions hereof, for any purpose, without fee, subject +to the following restrictions: + + 1. The origin of this source code must not be misrepresented. + + 2. Altered versions must be plainly marked as such and must not + be misrepresented as being the original source. + + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + +The Contributing Authors and Group 42, Inc. specifically permit, +without fee, and encourage the use of this source code as a component +to supporting the PNG file format in commercial products. If you use +this source code in a product, acknowledgment is not required but would +be appreciated. + +------------------------------------------------------------------------------ +libz is redistributed within all opencv-python Linux packages. +This license applies to libz binary in the directory cv2/. + + Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + +------------------------------------------------------------------------------ +libdav1d is redistributed within opencv-python macOS packages. +This license applies to libdav1d binary in the directory cv2/. + +Copyright © 2018-2019, VideoLAN and dav1d authors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ +libffi is redistributed within opencv-python macOS packages. +This license applies to libffi binary in the directory cv2/. + +libffi - Copyright (c) 1996-2020 Anthony Green, Red Hat, Inc and others. +See source files for details. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +------------------------------------------------------------------------------ +libogg is redistributed within opencv-python macOS packages. +This license applies to libogg binary in the directory cv2/. + +Copyright (c) 2002, Xiph.org Foundation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of the Xiph.org Foundation nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ +libopenjp2 is redistributed within opencv-python macOS packages. +This license applies to libopenjp2 binary in the directory cv2/. + +The copyright in this software is being made available under the 2-clauses +BSD License, included below. This software may be subject to other third +party and contributor rights, including patent rights, and no such rights +are granted under this license. + +Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium +Copyright (c) 2002-2014, Professor Benoit Macq +Copyright (c) 2003-2014, Antonin Descampe +Copyright (c) 2003-2009, Francois-Olivier Devaux +Copyright (c) 2005, Herve Drolon, FreeImage Team +Copyright (c) 2002-2003, Yannick Verschueren +Copyright (c) 2001-2003, David Janssens +Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France +Copyright (c) 2012, CS Systemes d'Information, France + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ +libopus is redistributed within opencv-python macOS packages. +This license applies to libopus binary in the directory cv2/. + +Copyright 2001-2011 Xiph.Org, Skype Limited, Octasic, + Jean-Marc Valin, Timothy B. Terriberry, + CSIRO, Gregory Maxwell, Mark Borgerding, + Erik de Castro Lopo + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of Internet Society, IETF or IETF Trust, nor the +names of specific contributors, may be used to endorse or promote +products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Opus is subject to the royalty-free patent licenses which are +specified at: + +Xiph.Org Foundation: +https://datatracker.ietf.org/ipr/1524/ + +Microsoft Corporation: +https://datatracker.ietf.org/ipr/1914/ + +Broadcom Corporation: +https://datatracker.ietf.org/ipr/1526/ + +------------------------------------------------------------------------------ +librav1e is redistributed within opencv-python macOS packages. +This license applies to librav1e binary in the directory cv2/. + +BSD 2-Clause License + +Copyright (c) 2017-2020, the rav1e contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ +libsnappy is redistributed within opencv-python macOS packages. +This license applies to libsnappy binary in the directory cv2/. + +Copyright 2011, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ +libspeex is redistributed within opencv-python macOS packages. +This license applies to libspeex binary in the directory cv2/. + +Copyright 2002-2008 Xiph.org Foundation +Copyright 2002-2008 Jean-Marc Valin +Copyright 2005-2007 Analog Devices Inc. +Copyright 2005-2008 Commonwealth Scientific and Industrial Research + Organisation (CSIRO) +Copyright 1993, 2002, 2006 David Rowe +Copyright 2003 EpicGames +Copyright 1992-1994 Jutta Degener, Carsten Bormann + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of the Xiph.org Foundation nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ +libsrt is redistributed within opencv-python macOS packages. +This license applies to libsrt binary in the directory cv2/. + +/* + * + * Copyright (c) 2001-2017 Cisco Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * Neither the name of the Cisco Systems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. + +------------------------------------------------------------------------------ +libtheoradec and libtheoraenc are redistributed within opencv-python macOS packages. +This license applies to libtheoradec and libtheoraenc binaries in the directory cv2/. + + Copyright (C) 2002-2009 Xiph.org Foundation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of the Xiph.org Foundation nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ +libwebp and libwebpmux are redistributed within all opencv-python packages. +This license applies to libwebp and libwebpmux binaries in the directory cv2/. + +Copyright (c) 2010, Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ +libvorbis and libvorbisenc are redistributed within opencv-python macOS packages. +This license applies to libvorbis and libvorbisenc binaries in the directory cv2/. + +Copyright (c) 2002-2020 Xiph.org Foundation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of the Xiph.org Foundation nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ +Libxcb utility libraries are redistributed within opencv-python non-headless Linux packages. +This license applies to libxcb related binaries in the directory cv2/. + +Copyright (C) 2001-2006 Bart Massey, Jamey Sharp, and Josh Triplett. +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the names of the authors +or their institutions shall not be used in advertising or +otherwise to promote the sale, use or other dealings in this +Software without prior written authorization from the +authors. + +------------------------------------------------------------------------------ +Libxcb-image is redistributed within opencv-python non-headless Linux packages. +This license applies to libxcb-image binary in the directory cv2/. + +Copyright © 2007-2008 Bart Massey +Copyright © 2008 Julien Danjou +Copyright © 2008 Keith Packard + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the names of the authors or +their institutions shall not be used in advertising or otherwise to +promote the sale, use or other dealings in this Software without +prior written authorization from the authors. + +------------------------------------------------------------------------------ +Libxcb-util is redistributed within opencv-python non-headless Linux packages. +This license applies to libxcb-util binary in the directory cv2/. + +Copyright © 2008 Bart Massey +Copyright © 2008 Ian Osgood +Copyright © 2008 Jamey Sharp +Copyright © 2008 Josh Triplett +Copyright © 2008-2009 Julien Danjou + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the names of the authors or +their institutions shall not be used in advertising or otherwise to +promote the sale, use or other dealings in this Software without +prior written authorization from the authors. + +------------------------------------------------------------------------------ +Libxcb-render-util is redistributed within opencv-python non-headless Linux packages. +This license applies to libxcb-render-util binary in the directory cv2/. + +Copyright © 2000 Keith Packard + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation, and that the name of Keith Packard not be used in +advertising or publicity pertaining to distribution of the software without +specific, written prior permission. Keith Packard makes no +representations about the suitability of this software for any purpose. It +is provided "as is" without express or implied warranty. + +KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +Copyright © 2006 Jamey Sharp. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the names of the authors or their +institutions shall not be used in advertising or otherwise to promote the +sale, use or other dealings in this Software without prior written +authorization from the authors. + +Copyright © 2006 Ian Osgood + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the names of the authors or their +institutions shall not be used in advertising or otherwise to promote the +sale, use or other dealings in this Software without prior written +authorization from the authors. + +------------------------------------------------------------------------------ +Libxcb-icccm is redistributed within opencv-python non-headless Linux packages. +This license applies to Libxcb-icccm binary in the directory cv2/. + +Copyright © 2008-2011 Arnaud Fontaine +Copyright © 2007-2008 Vincent Torri + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the names of the authors or +their institutions shall not be used in advertising or otherwise to +promote the sale, use or other dealings in this Software without +prior written authorization from the authors. + +------------------------------------------------------------------------------ +libXau is redistributed within opencv-python non-headless Linux packages. +This license applies to libXau binary in the directory cv2/. + +Copyright 1988, 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +------------------------------------------------------------------------------ +Vulkan headers are redistributed within all opencv-python packages. +This license applies to Vulkan headers in the directory 3rdparty/include/vulkan. + +Copyright (c) 2015-2018 The Khronos Group Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +------------------------------------------------------------------------------ +Libjpeg-turbo is redistributed within all opencv-python packages as build option. + +libjpeg-turbo Licenses +====================== + +libjpeg-turbo is covered by three compatible BSD-style open source licenses: + +- The IJG (Independent JPEG Group) License, which is listed in + [README.ijg](README.ijg) + + This license applies to the libjpeg API library and associated programs + (any code inherited from libjpeg, and any modifications to that code.) + +- The Modified (3-clause) BSD License, which is listed below + + This license covers the TurboJPEG API library and associated programs, as + well as the build system. + +- The [zlib License](https://opensource.org/licenses/Zlib) + + This license is a subset of the other two, and it covers the libjpeg-turbo + SIMD extensions. + + +Complying with the libjpeg-turbo Licenses +========================================= + +This section provides a roll-up of the libjpeg-turbo licensing terms, to the +best of our understanding. + +1. If you are distributing a modified version of the libjpeg-turbo source, + then: + + 1. You cannot alter or remove any existing copyright or license notices + from the source. + + **Origin** + - Clause 1 of the IJG License + - Clause 1 of the Modified BSD License + - Clauses 1 and 3 of the zlib License + + 2. You must add your own copyright notice to the header of each source + file you modified, so others can tell that you modified that file (if + there is not an existing copyright header in that file, then you can + simply add a notice stating that you modified the file.) + + **Origin** + - Clause 1 of the IJG License + - Clause 2 of the zlib License + + 3. You must include the IJG README file, and you must not alter any of the + copyright or license text in that file. + + **Origin** + - Clause 1 of the IJG License + +2. If you are distributing only libjpeg-turbo binaries without the source, or + if you are distributing an application that statically links with + libjpeg-turbo, then: + + 1. Your product documentation must include a message stating: + + This software is based in part on the work of the Independent JPEG + Group. + + **Origin** + - Clause 2 of the IJG license + + 2. If your binary distribution includes or uses the TurboJPEG API, then + your product documentation must include the text of the Modified BSD + License (see below.) + + **Origin** + - Clause 2 of the Modified BSD License + +3. You cannot use the name of the IJG or The libjpeg-turbo Project or the + contributors thereof in advertising, publicity, etc. + + **Origin** + - IJG License + - Clause 3 of the Modified BSD License + +4. The IJG and The libjpeg-turbo Project do not warrant libjpeg-turbo to be + free of defects, nor do we accept any liability for undesirable + consequences resulting from your use of the software. + + **Origin** + - IJG License + - Modified BSD License + - zlib License + + +The Modified (3-clause) BSD License +=================================== + +Copyright (C)2009-2022 D. R. Commander. All Rights Reserved.
+Copyright (C)2015 Viktor Szathmáry. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +- Neither the name of the libjpeg-turbo Project nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + + +Why Three Licenses? +=================== + +The zlib License could have been used instead of the Modified (3-clause) BSD +License, and since the IJG License effectively subsumes the distribution +conditions of the zlib License, this would have effectively placed +libjpeg-turbo binary distributions under the IJG License. However, the IJG +License specifically refers to the Independent JPEG Group and does not extend +attribution and endorsement protections to other entities. Thus, it was +desirable to choose a license that granted us the same protections for new code +that were granted to the IJG for code derived from their software. + +------------------------------------------------------------------------------ +Libspng is redistributed within all opencv-python packages as build option. + +BSD 2-Clause License + +Copyright (c) 2018-2022, Randy +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ +QUIRC library is redistributed within all opencv-python packages. + +quirc -- QR-code recognition library +Copyright (C) 2010-2012 Daniel Beer + +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted, provided that the +above copyright notice and this permission notice appear in all +copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +------------------------------------------------------------------------------ +Flatbuffers library is redistributed within all opencv-python packages. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +------------------------------------------------------------------------------ +Protobuf library is redistributed within all opencv-python packages. + +Copyright 2008 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Code generated by the Protocol Buffer compiler is owned by the owner +of the input file used when generating it. This code is not +standalone and requires a support library to be linked with it. This +support library is itself covered by the above license. + +------------------------------------------------------------------------------ +OpenJPEG library is redistributed within all opencv-python packages. + +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium + * Copyright (c) 2002-2014, Professor Benoit Macq + * Copyright (c) 2003-2014, Antonin Descampe + * Copyright (c) 2003-2009, Francois-Olivier Devaux + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * Copyright (c) 2002-2003, Yannick Verschueren + * Copyright (c) 2001-2003, David Janssens + * Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France + * Copyright (c) 2012, CS Systemes d'Information, France + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +------------------------------------------------------------------------------ +TIFF library is redistributed within all opencv-python packages. + +Copyright (c) 1988-1997 Sam Leffler +Copyright (c) 1991-1997 Silicon Graphics, Inc. + +Permission to use, copy, modify, distribute, and sell this software and +its documentation for any purpose is hereby granted without fee, provided +that (i) the above copyright notices and this permission notice appear in +all copies of the software and related documentation, and (ii) the names of +Sam Leffler and Silicon Graphics may not be used in any advertising or +publicity relating to the software without the specific, prior written +permission of Sam Leffler and Silicon Graphics. + +THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +OF THIS SOFTWARE. + +------------------------------------------------------------------------------ +OpenEXR library is redistributed within all opencv-python packages. + +Copyright (c) 2006, Industrial Light & Magic, a division of Lucasfilm +Entertainment Company Ltd. Portions contributed and copyright held by +others as indicated. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided with + the distribution. + + * Neither the name of Industrial Light & Magic nor the names of + any other contributors to this software may be used to endorse or + promote products derived from this software without specific prior + written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ +Intel(R) IPP ICV library statically linked within x86 and x86_64 opencv-python packages. + +Intel(R) Integrated Performance Primitives 2021 Update 10 + +Intel Simplified Software License (Version October 2022) + +Intel(R) Integrated Performance Primitives (Intel(R) IPP) : Copyright (C) 1997 Intel Corporation + +Use and Redistribution. You may use and redistribute the software, which is +provided in binary form only, (the "Software"), without modification, +provided the following conditions are met: + +* Redistributions must reproduce the above copyright notice and these + terms of use in the Software and in the documentation and/or other materials + provided with the distribution. +* Neither the name of Intel nor the names of its suppliers may be used to + endorse or promote products derived from this Software without specific + prior written permission. +* No reverse engineering, decompilation, or disassembly of the Software is + permitted, nor any modification or alteration of the Software or its operation + at any time, including during execution. + +No other licenses. Except as provided in the preceding section, Intel grants no +licenses or other rights by implication, estoppel or otherwise to, patent, +copyright, trademark, trade name, service mark or other intellectual property +licenses or rights of Intel. + +Third party software. "Third Party Software" means the files (if any) listed +in the "third-party-software.txt" or other similarly-named text file that may +be included with the Software. Third Party Software, even if included with the +distribution of the Software, may be governed by separate license terms, including +without limitation, third party license terms, open source software notices and +terms, and/or other Intel software license terms. These separate license terms +solely govern Your use of the Third Party Software. + +DISCLAIMER. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT ARE +DISCLAIMED. THIS SOFTWARE IS NOT INTENDED FOR USE IN SYSTEMS OR APPLICATIONS +WHERE FAILURE OF THE SOFTWARE MAY CAUSE PERSONAL INJURY OR DEATH AND YOU AGREE +THAT YOU ARE FULLY RESPONSIBLE FOR ANY CLAIMS, COSTS, DAMAGES, EXPENSES, AND +ATTORNEYS' FEES ARISING OUT OF ANY SUCH USE, EVEN IF ANY CLAIM ALLEGES THAT +INTEL WAS NEGLIGENT REGARDING THE DESIGN OR MANUFACTURE OF THE SOFTWARE. + +LIMITATION OF LIABILITY. IN NO EVENT WILL INTEL BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +No support. Intel may make changes to the Software, at any time without notice, +and is not obligated to support, update or provide training for the Software. + +Termination. Your right to use the Software is terminated in the event of your +breach of this license. + +Feedback. Should you provide Intel with comments, modifications, corrections, +enhancements or other input ("Feedback") related to the Software, Intel will be +free to use, disclose, reproduce, license or otherwise distribute or exploit the +Feedback in its sole discretion without any obligations or restrictions of any +kind, including without limitation, intellectual property rights or licensing +obligations. + +Compliance with laws. You agree to comply with all relevant laws and regulations +governing your use, transfer, import or export (or prohibition thereof) of the +Software. + +Governing law. All disputes will be governed by the laws of the United States of +America and the State of Delaware without reference to conflict of law +principles and subject to the exclusive jurisdiction of the state or federal +courts sitting in the State of Delaware, and each party agrees that it submits +to the personal jurisdiction and venue of those courts and waives any +objections. THE UNITED NATIONS CONVENTION ON CONTRACTS FOR THE INTERNATIONAL +SALE OF GOODS (1980) IS SPECIFICALLY EXCLUDED AND WILL NOT APPLY TO THE SOFTWARE. diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/LICENSE.txt b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..328bf50632a988cf1cc494d557936d84fec16335 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Olli-Pekka Heinisuo + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/METADATA b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..3463c62963711c7c426e573e1c0e5268c62ec940 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/METADATA @@ -0,0 +1,305 @@ +Metadata-Version: 2.1 +Name: opencv-python +Version: 4.9.0.80 +Summary: Wrapper package for OpenCV python bindings. +Home-page: https://github.com/opencv/opencv-python +Maintainer: OpenCV Team +License: Apache 2.0 +Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Console +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Education +Classifier: Intended Audience :: Information Technology +Classifier: Intended Audience :: Science/Research +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Operating System :: MacOS +Classifier: Operating System :: Microsoft :: Windows +Classifier: Operating System :: POSIX +Classifier: Operating System :: Unix +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: C++ +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Topic :: Scientific/Engineering +Classifier: Topic :: Scientific/Engineering :: Image Recognition +Classifier: Topic :: Software Development +Requires-Python: >=3.6 +Description-Content-Type: text/markdown +License-File: LICENSE-3RD-PARTY.txt +License-File: LICENSE.txt +Requires-Dist: numpy >=1.13.3 ; python_version < "3.7" +Requires-Dist: numpy >=1.21.0 ; python_version <= "3.9" and platform_system == "Darwin" and platform_machine == "arm64" +Requires-Dist: numpy >=1.21.2 ; python_version >= "3.10" +Requires-Dist: numpy >=1.21.4 ; python_version >= "3.10" and platform_system == "Darwin" +Requires-Dist: numpy >=1.23.5 ; python_version >= "3.11" +Requires-Dist: numpy >=1.26.0 ; python_version >= "3.12" +Requires-Dist: numpy >=1.19.3 ; python_version >= "3.6" and platform_system == "Linux" and platform_machine == "aarch64" +Requires-Dist: numpy >=1.17.0 ; python_version >= "3.7" +Requires-Dist: numpy >=1.17.3 ; python_version >= "3.8" +Requires-Dist: numpy >=1.19.3 ; python_version >= "3.9" + +[![Downloads](https://static.pepy.tech/badge/opencv-python)](http://pepy.tech/project/opencv-python) + +### Keep OpenCV Free + +OpenCV is raising funds to keep the library free for everyone, and we need the support of the entire community to do it. [Donate to OpenCV on IndieGoGo](http://igg.me/at/opencv5) to show your support. + +- [OpenCV on Wheels](#opencv-on-wheels) + - [Installation and Usage](#installation-and-usage) +- [Frequently Asked Questions](#frequently-asked-questions) +- [Documentation for opencv-python](#documentation-for-opencv-python) + - [CI build process](#ci-build-process) + - [Manual builds](#manual-builds) + - [Manual debug builds](#manual-debug-builds) + - [Source distributions](#source-distributions) + - [Licensing](#licensing) + - [Versioning](#versioning) + - [Releases](#releases) + - [Development builds](#development-builds) + - [Manylinux wheels](#manylinux-wheels) + - [Supported Python versions](#supported-python-versions) + - [Backward compatibility](#backward-compatibility) + +## OpenCV on Wheels + +Pre-built CPU-only OpenCV packages for Python. + +Check the manual build section if you wish to compile the bindings from source to enable additional modules such as CUDA. + +### Installation and Usage + +1. If you have previous/other manually installed (= not installed via ``pip``) version of OpenCV installed (e.g. cv2 module in the root of Python's site-packages), remove it before installation to avoid conflicts. +2. Make sure that your `pip` version is up-to-date (19.3 is the minimum supported version): `pip install --upgrade pip`. Check version with `pip -V`. For example Linux distributions ship usually with very old `pip` versions which cause a lot of unexpected problems especially with the `manylinux` format. +3. Select the correct package for your environment: + + There are four different packages (see options 1, 2, 3 and 4 below) and you should **SELECT ONLY ONE OF THEM**. Do not install multiple different packages in the same environment. There is no plugin architecture: all the packages use the same namespace (`cv2`). If you installed multiple different packages in the same environment, uninstall them all with ``pip uninstall`` and reinstall only one package. + + **a.** Packages for standard desktop environments (Windows, macOS, almost any GNU/Linux distribution) + + - Option 1 - Main modules package: ``pip install opencv-python`` + - Option 2 - Full package (contains both main modules and contrib/extra modules): ``pip install opencv-contrib-python`` (check contrib/extra modules listing from [OpenCV documentation](https://docs.opencv.org/master/)) + + **b.** Packages for server (headless) environments (such as Docker, cloud environments etc.), no GUI library dependencies + + These packages are smaller than the two other packages above because they do not contain any GUI functionality (not compiled with Qt / other GUI components). This means that the packages avoid a heavy dependency chain to X11 libraries and you will have for example smaller Docker images as a result. You should always use these packages if you do not use `cv2.imshow` et al. or you are using some other package (such as PyQt) than OpenCV to create your GUI. + + - Option 3 - Headless main modules package: ``pip install opencv-python-headless`` + - Option 4 - Headless full package (contains both main modules and contrib/extra modules): ``pip install opencv-contrib-python-headless`` (check contrib/extra modules listing from [OpenCV documentation](https://docs.opencv.org/master/)) + +4. Import the package: + + ``import cv2`` + + All packages contain Haar cascade files. ``cv2.data.haarcascades`` can be used as a shortcut to the data folder. For example: + + ``cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_frontalface_default.xml")`` + +5. Read [OpenCV documentation](https://docs.opencv.org/master/) + +6. Before opening a new issue, read the FAQ below and have a look at the other issues which are already open. + +Frequently Asked Questions +-------------------------- + +**Q: Do I need to install also OpenCV separately?** + +A: No, the packages are special wheel binary packages and they already contain statically built OpenCV binaries. + +**Q: Pip install fails with ``ModuleNotFoundError: No module named 'skbuild'``?** + +Since ``opencv-python`` version 4.3.0.\*, ``manylinux1`` wheels were replaced by ``manylinux2014`` wheels. If your pip is too old, it will try to use the new source distribution introduced in 4.3.0.38 to manually build OpenCV because it does not know how to install ``manylinux2014`` wheels. However, source build will also fail because of too old ``pip`` because it does not understand build dependencies in ``pyproject.toml``. To use the new ``manylinux2014`` pre-built wheels (or to build from source), your ``pip`` version must be >= 19.3. Please upgrade ``pip`` with ``pip install --upgrade pip``. + +**Q: Import fails on Windows: ``ImportError: DLL load failed: The specified module could not be found.``?** + +A: If the import fails on Windows, make sure you have [Visual C++ redistributable 2015](https://www.microsoft.com/en-us/download/details.aspx?id=48145) installed. If you are using older Windows version than Windows 10 and latest system updates are not installed, [Universal C Runtime](https://support.microsoft.com/en-us/help/2999226/update-for-universal-c-runtime-in-windows) might be also required. + +Windows N and KN editions do not include Media Feature Pack which is required by OpenCV. If you are using Windows N or KN edition, please install also [Windows Media Feature Pack](https://support.microsoft.com/en-us/help/3145500/media-feature-pack-list-for-windows-n-editions). + +If you have Windows Server 2012+, media DLLs are probably missing too; please install the Feature called "Media Foundation" in the Server Manager. Beware, some posts advise to install "Windows Server Essentials Media Pack", but this one requires the "Windows Server Essentials Experience" role, and this role will deeply affect your Windows Server configuration (by enforcing active directory integration etc.); so just installing the "Media Foundation" should be a safer choice. + +If the above does not help, check if you are using Anaconda. Old Anaconda versions have a bug which causes the error, see [this issue](https://github.com/opencv/opencv-python/issues/36) for a manual fix. + +If you still encounter the error after you have checked all the previous solutions, download [Dependencies](https://github.com/lucasg/Dependencies) and open the ``cv2.pyd`` (located usually at ``C:\Users\username\AppData\Local\Programs\Python\PythonXX\Lib\site-packages\cv2``) file with it to debug missing DLL issues. + +**Q: I have some other import errors?** + +A: Make sure you have removed old manual installations of OpenCV Python bindings (cv2.so or cv2.pyd in site-packages). + +**Q: Function foo() or method bar() returns wrong result, throws exception or crashes interpreter. What should I do?** + +A: The repository contains only OpenCV-Python package build scripts, but not OpenCV itself. Python bindings for OpenCV are developed in official OpenCV repository and it's the best place to report issues. Also please check [OpenCV wiki](https://github.com/opencv/opencv/wiki) and [the official OpenCV forum](https://forum.opencv.org/) before file new bugs. + +**Q: Why the packages do not include non-free algorithms?** + +A: Non-free algorithms such as SURF are not included in these packages because they are patented / non-free and therefore cannot be distributed as built binaries. Note that SIFT is included in the builds due to patent expiration since OpenCV versions 4.3.0 and 3.4.10. See this issue for more info: https://github.com/skvark/opencv-python/issues/126 + +**Q: Why the package and import are different (opencv-python vs. cv2)?** + +A: It's easier for users to understand ``opencv-python`` than ``cv2`` and it makes it easier to find the package with search engines. `cv2` (old interface in old OpenCV versions was named as `cv`) is the name that OpenCV developers chose when they created the binding generators. This is kept as the import name to be consistent with different kind of tutorials around the internet. Changing the import name or behaviour would be also confusing to experienced users who are accustomed to the ``import cv2``. + +## Documentation for opencv-python + +[![Windows Build Status](https://github.com/opencv/opencv-python/actions/workflows/build_wheels_windows.yml/badge.svg)](https://github.com/opencv/opencv-python/actions/workflows/build_wheels_windows.yml) +[![(Linux Build status)](https://github.com/opencv/opencv-python/actions/workflows/build_wheels_linux.yml/badge.svg)](https://github.com/opencv/opencv-python/actions/workflows/build_wheels_linux.yml) +[![(Mac OS Build status)](https://github.com/opencv/opencv-python/actions/workflows/build_wheels_macos.yml/badge.svg)](https://github.com/opencv/opencv-python/actions/workflows/build_wheels_macos.yml) + +The aim of this repository is to provide means to package each new [OpenCV release](https://github.com/opencv/opencv/releases) for the most used Python versions and platforms. + +### CI build process + +The project is structured like a normal Python package with a standard ``setup.py`` file. +The build process for a single entry in the build matrices is as follows (see for example `.github/workflows/build_wheels_linux.yml` file): + +0. In Linux and MacOS build: get OpenCV's optional C dependencies that we compile against + +1. Checkout repository and submodules + + - OpenCV is included as submodule and the version is updated + manually by maintainers when a new OpenCV release has been made + - Contrib modules are also included as a submodule + +2. Find OpenCV version from the sources + +3. Build OpenCV + + - tests are disabled, otherwise build time increases too much + - there are 4 build matrix entries for each build combination: with and without contrib modules, with and without GUI (headless) + - Linux builds run in manylinux Docker containers (CentOS 5) + - source distributions are separate entries in the build matrix + +4. Rearrange OpenCV's build result, add our custom files and generate wheel + +5. Linux and macOS wheels are transformed with auditwheel and delocate, correspondingly + +6. Install the generated wheel +7. Test that Python can import the library and run some sanity checks +8. Use twine to upload the generated wheel to PyPI (only in release builds) + +Steps 1--4 are handled by ``pip wheel``. + +The build can be customized with environment variables. In addition to any variables that OpenCV's build accepts, we recognize: + +- ``CI_BUILD``. Set to ``1`` to emulate the CI environment build behaviour. Used only in CI builds to force certain build flags on in ``setup.py``. Do not use this unless you know what you are doing. +- ``ENABLE_CONTRIB`` and ``ENABLE_HEADLESS``. Set to ``1`` to build the contrib and/or headless version +- ``ENABLE_JAVA``, Set to ``1`` to enable the Java client build. This is disabled by default. +- ``CMAKE_ARGS``. Additional arguments for OpenCV's CMake invocation. You can use this to make a custom build. + +See the next section for more info about manual builds outside the CI environment. + +### Manual builds + +If some dependency is not enabled in the pre-built wheels, you can also run the build locally to create a custom wheel. + +1. Clone this repository: `git clone --recursive https://github.com/opencv/opencv-python.git` +2. ``cd opencv-python`` + - you can use `git` to checkout some other version of OpenCV in the `opencv` and `opencv_contrib` submodules if needed +3. Add custom Cmake flags if needed, for example: `export CMAKE_ARGS="-DSOME_FLAG=ON -DSOME_OTHER_FLAG=OFF"` (in Windows you need to set environment variables differently depending on Command Line or PowerShell) +4. Select the package flavor which you wish to build with `ENABLE_CONTRIB` and `ENABLE_HEADLESS`: i.e. `export ENABLE_CONTRIB=1` if you wish to build `opencv-contrib-python` +5. Run ``pip wheel . --verbose``. NOTE: make sure you have the latest ``pip`` version, the ``pip wheel`` command replaces the old ``python setup.py bdist_wheel`` command which does not support ``pyproject.toml``. + - this might take anything from 5 minutes to over 2 hours depending on your hardware +6. Pip will print fresh will location at the end of build procedure. If you use old approach with `setup.py` file wheel package will be placed in `dist` folder. Package is ready and you can do with that whatever you wish. + - Optional: on Linux use some of the `manylinux` images as a build hosts if maximum portability is needed and run `auditwheel` for the wheel after build + - Optional: on macOS use ``delocate`` (same as ``auditwheel`` but for macOS) for better portability + +#### Manual debug builds + +In order to build `opencv-python` in an unoptimized debug build, you need to side-step the normal process a bit. + +1. Install the packages `scikit-build` and `numpy` via pip. +2. Run the command `python setup.py bdist_wheel --build-type=Debug`. +3. Install the generated wheel file in the `dist/` folder with `pip install dist/wheelname.whl`. + +If you would like the build produce all compiler commands, then the following combination of flags and environment variables has been tested to work on Linux: +``` +export CMAKE_ARGS='-DCMAKE_VERBOSE_MAKEFILE=ON' +export VERBOSE=1 + +python3 setup.py bdist_wheel --build-type=Debug +``` + +See this issue for more discussion: https://github.com/opencv/opencv-python/issues/424 + +#### Source distributions + +Since OpenCV version 4.3.0, also source distributions are provided in PyPI. This means that if your system is not compatible with any of the wheels in PyPI, ``pip`` will attempt to build OpenCV from sources. If you need a OpenCV version which is not available in PyPI as a source distribution, please follow the manual build guidance above instead of this one. + +You can also force ``pip`` to build the wheels from the source distribution. Some examples: + +- ``pip install --no-binary opencv-python opencv-python`` +- ``pip install --no-binary :all: opencv-python`` + +If you need contrib modules or headless version, just change the package name (step 4 in the previous section is not needed). However, any additional CMake flags can be provided via environment variables as described in step 3 of the manual build section. If none are provided, OpenCV's CMake scripts will attempt to find and enable any suitable dependencies. Headless distributions have hard coded CMake flags which disable all possible GUI dependencies. + +On slow systems such as Raspberry Pi the full build may take several hours. On a 8-core Ryzen 7 3700X the build takes about 6 minutes. + +### Licensing + +Opencv-python package (scripts in this repository) is available under MIT license. + +OpenCV itself is available under [Apache 2](https://github.com/opencv/opencv/blob/master/LICENSE) license. + +Third party package licenses are at [LICENSE-3RD-PARTY.txt](https://github.com/opencv/opencv-python/blob/master/LICENSE-3RD-PARTY.txt). + +All wheels ship with [FFmpeg](http://ffmpeg.org) licensed under the [LGPLv2.1](http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html). + +Non-headless Linux wheels ship with [Qt 5](http://doc.qt.io/qt-5/lgpl.html) licensed under the [LGPLv3](http://www.gnu.org/licenses/lgpl-3.0.html). + +The packages include also other binaries. Full list of licenses can be found from [LICENSE-3RD-PARTY.txt](https://github.com/opencv/opencv-python/blob/master/LICENSE-3RD-PARTY.txt). + +### Versioning + +``find_version.py`` script searches for the version information from OpenCV sources and appends also a revision number specific to this repository to the version string. It saves the version information to ``version.py`` file under ``cv2`` in addition to some other flags. + +### Releases + +A release is made and uploaded to PyPI when a new tag is pushed to master branch. These tags differentiate packages (this repo might have modifications but OpenCV version stays same) and should be incremented sequentially. In practice, release version numbers look like this: + +``cv_major.cv_minor.cv_revision.package_revision`` e.g. ``3.1.0.0`` + +The master branch follows OpenCV master branch releases. 3.4 branch follows OpenCV 3.4 bugfix releases. + +### Development builds + +Every commit to the master branch of this repo will be built. Possible build artifacts use local version identifiers: + +``cv_major.cv_minor.cv_revision+git_hash_of_this_repo`` e.g. ``3.1.0+14a8d39`` + +These artifacts can't be and will not be uploaded to PyPI. + +### Manylinux wheels + +Linux wheels are built using [manylinux2014](https://github.com/pypa/manylinux). These wheels should work out of the box for most of the distros (which use GNU C standard library) out there since they are built against an old version of glibc. + +The default ``manylinux2014`` images have been extended with some OpenCV dependencies. See [Docker folder](https://github.com/skvark/opencv-python/tree/master/docker) for more info. + +### Supported Python versions + +Python 3.x compatible pre-built wheels are provided for the officially supported Python versions (not in EOL): + +- 3.7 +- 3.8 +- 3.9 +- 3.10 +- 3.11 +- 3.12 + +### Backward compatibility + +Starting from 4.2.0 and 3.4.9 builds the macOS Travis build environment was updated to XCode 9.4. The change effectively dropped support for older than 10.13 macOS versions. + +Starting from 4.3.0 and 3.4.10 builds the Linux build environment was updated from `manylinux1` to `manylinux2014`. This dropped support for old Linux distributions. + +Starting from version 4.7.0 the Mac OS GitHub Actions build environment was update to version 11. Mac OS 10.x support depricated. See https://github.com/actions/runner-images/issues/5583 + +Starting from version 4.9.0 the Mac OS GitHub Actions build environment was update to version 12. Mac OS 10.x support depricated by Brew and most of used packages. + + diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/RECORD b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..bd9a50edf9c06c83a4d483a1bdb36dd2a95d19b3 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/RECORD @@ -0,0 +1,144 @@ +cv2/Error/__init__.pyi,sha256=A6NKtoMeZAvZWHC6DrJiwMVChY7LLxFfvuZ2dW4KSm8,4076 +cv2/LICENSE-3RD-PARTY.txt,sha256=ZKuaw_WkYDDW2Lvnl7aukYqNLQGG5HyiBLc0MbHrHMw,151157 +cv2/LICENSE.txt,sha256=CdcZBY54Kse8cbohyUThE2zeK7lXwOiIEh8CGNa18Cw,1070 +cv2/__init__.py,sha256=1tRL4PD5gcwFerwMFSN3tJbttHjR-mNVzgNfcR3JSyU,6575 +cv2/__init__.pyi,sha256=evrJ7NbPFLgLGRiXV2F72kL9oerfKLFBEqD-P5wcfxg,293784 +cv2/__pycache__/__init__.cpython-38.pyc,, +cv2/__pycache__/config-3.cpython-38.pyc,, +cv2/__pycache__/config.cpython-38.pyc,, +cv2/__pycache__/load_config_py2.cpython-38.pyc,, +cv2/__pycache__/load_config_py3.cpython-38.pyc,, +cv2/__pycache__/version.cpython-38.pyc,, +cv2/aruco/__init__.pyi,sha256=XOaNz4SbfQ0UFH8guZ9WgTybx8gekTOWr8452Yjz54E,13995 +cv2/barcode/__init__.pyi,sha256=rUP5152HBCKUQ3WUqPl2zS5nI2w9v-AHaCeXYqPglxk,1029 +cv2/config-3.py,sha256=mnqt9yS4IgAfXpY7Af1ON11F4su-Mo0sp7QqRAwIOhw,724 +cv2/config.py,sha256=l04tQJbuGpqaNB3xvzPhaXNoO_GsczAG3if_LyO8WE0,111 +cv2/cuda/__init__.pyi,sha256=gNkBAoEdrvkxwo4brAXNBCU_RDWixz575CWi2YEvYK4,16036 +cv2/cv2.abi3.so,sha256=jbX0ZuzuXpODBp5u45ca4U4wutGrGaS8801TfBQmLFE,65162889 +cv2/data/__init__.py,sha256=125Pcte_OtB55ZxjWg5ko8ugpnogZ1sRMyP48dtBCMw,70 +cv2/data/__pycache__/__init__.cpython-38.pyc,, +cv2/data/haarcascade_eye.xml,sha256=ccxk_DBaNV3GAGeID2-71D3RVb1j7jhEZhob2jSy_Yw,341406 +cv2/data/haarcascade_eye_tree_eyeglasses.xml,sha256=4y-cZ5NcM-nRMx6xT6WFVP8Xg1wDdCZjvLl6iS6Talc,601661 +cv2/data/haarcascade_frontalcatface.xml,sha256=rCusk07yQoTviisunY5X7vhKwdaUO00R5cnoWE3Aacg,411388 +cv2/data/haarcascade_frontalcatface_extended.xml,sha256=_9DR0o8H0DdsidtMmEUAnChVzHbIz_dj1TMdyTYdqFQ,382918 +cv2/data/haarcascade_frontalface_alt.xml,sha256=YoHfE0Wcwhj_BH0Csq44WbEv8UqT_-iVL3sz-te5aXs,676709 +cv2/data/haarcascade_frontalface_alt2.xml,sha256=ewyWfZq7373gJeuceGlH0VG2QmBA0HqPlWLtj9kHJLQ,540616 +cv2/data/haarcascade_frontalface_alt_tree.xml,sha256=Dl7kfswTJp1U3XpV-LU3UhZ8Ulh3IId3MjiPsHigSAo,2689040 +cv2/data/haarcascade_frontalface_default.xml,sha256=D31FJ4ROtRTUpJSOgi2pD7sWo0oLu7xq3GSYdHpar7A,930127 +cv2/data/haarcascade_fullbody.xml,sha256=BBdFxx7vG1yGrvIk8XznWwQtMzFMyPZ1dCT4vYzTCqE,476827 +cv2/data/haarcascade_lefteye_2splits.xml,sha256=dMMjx4yBR1_JFY-sv7hmuwzKBr5B9XHfR9SsjQH5zkw,195369 +cv2/data/haarcascade_license_plate_rus_16stages.xml,sha256=TRxEv3obxOIE-iWwRu0Kz_1_cTzBP-KVi2l3Elxg3eo,47775 +cv2/data/haarcascade_lowerbody.xml,sha256=HmluHHxmxDmuIpz_-IcfQgN8NX6eHgkKK1nrwfj_XLs,395322 +cv2/data/haarcascade_profileface.xml,sha256=s5pKO-RVOdsUan_B0-dhopLBluuIQhGF5qYVswVeYS0,828514 +cv2/data/haarcascade_righteye_2splits.xml,sha256=TPDXK-pzB-mvfrmdSsvhXXEBpnwi_Nz77v1pKtN893Y,196170 +cv2/data/haarcascade_russian_plate_number.xml,sha256=gUy1lUaCr1cOWDYfnl-LW1E6QRJ3a7nsrO-fDkymwtc,75482 +cv2/data/haarcascade_smile.xml,sha256=TKHzBOq9C1rjAYDIGstT4Walhn5b4Xsxa9PzLP34fYo,188506 +cv2/data/haarcascade_upperbody.xml,sha256=cyirT9sVkvU9mNfqWxudkOAa9dlfISrzeMfrV5BIu18,785819 +cv2/detail/__init__.pyi,sha256=FXndW6oxsE46hjgKBezLvqJ_iEAcOCmNOAZSpbSM_-8,22374 +cv2/dnn/__init__.pyi,sha256=lmSN_5FJ1DrbXpIPe8iZijAK2LJDeVb-_3VOJswt6gc,22683 +cv2/fisheye/__init__.pyi,sha256=Oo9DhbwF5E2wsousnSQ9m4z6p-dMQGSxsTsDoO1Ni8g,7815 +cv2/flann/__init__.pyi,sha256=ZxYG07bhFyFRA2d1lbPmAm_KEknsTcE1_NNw_Ksz1HQ,2677 +cv2/gapi/__init__.py,sha256=6WBAjfq1FCiRADgYXGAKITHdBB6t0_jZ8hkTU8Biz-M,10298 +cv2/gapi/__init__.pyi,sha256=zCLTsHvmbiGmlDUXPWqOGdgFcj66_iw7FXiTr4Y91m0,14636 +cv2/gapi/__pycache__/__init__.cpython-38.pyc,, +cv2/gapi/core/__init__.pyi,sha256=_3OM_ITOrZomn7gs4HM-DRk8ngbjWkdr26KrmH3t4ks,142 +cv2/gapi/core/cpu/__init__.pyi,sha256=MfRTDEPtcQekGnrvoaSSadxyylXPfa2lz8ucAkzjmh8,93 +cv2/gapi/core/fluid/__init__.pyi,sha256=MfRTDEPtcQekGnrvoaSSadxyylXPfa2lz8ucAkzjmh8,93 +cv2/gapi/core/ocl/__init__.pyi,sha256=MfRTDEPtcQekGnrvoaSSadxyylXPfa2lz8ucAkzjmh8,93 +cv2/gapi/ie/__init__.pyi,sha256=rbOXOU39Wpt9Lhh1o1qr7Zj7qljqAu6aqoYsm4433yQ,1117 +cv2/gapi/ie/detail/__init__.pyi,sha256=hGTS3yIiIq1B-djXgSQIPmeF7VDyeyucUuZOnd4O0OQ,269 +cv2/gapi/imgproc/__init__.pyi,sha256=UUtPJcDK_UaE_TKN8K9Oz1TEChCQHDDB_eTI08mVXmU,71 +cv2/gapi/imgproc/fluid/__init__.pyi,sha256=MfRTDEPtcQekGnrvoaSSadxyylXPfa2lz8ucAkzjmh8,93 +cv2/gapi/oak/__init__.pyi,sha256=Tb7YXytKxnBFZZ8qTqHSZsDEpRt2937NXtbOQK23Ksc,1734 +cv2/gapi/onnx/__init__.pyi,sha256=XAQ4M2p7kcm0gSL_2OJkjoI8h5AzlHQh6xDQEX7z5e4,1344 +cv2/gapi/onnx/ep/__init__.pyi,sha256=3a7nzkkajyZBbTM2FKOI2eGM3GKTNGId_ZNEhghdrkU,1239 +cv2/gapi/ot/__init__.pyi,sha256=XTMT90lnElxl_KfhFi5xDwQWvB0g5N8tf7Cgb8VHcAY,720 +cv2/gapi/ot/cpu/__init__.pyi,sha256=MfRTDEPtcQekGnrvoaSSadxyylXPfa2lz8ucAkzjmh8,93 +cv2/gapi/ov/__init__.pyi,sha256=3BqKzC_lV-wzhwu2cawCBvGbMG_zxt5D6anjhORXvuM,2647 +cv2/gapi/own/__init__.pyi,sha256=GzL91pOQQNsGcBGmZ_XDAXaLoF4N9qVgj_IaYzduSNc,69 +cv2/gapi/own/detail/__init__.pyi,sha256=sTC8JFcjDcVxnaFfFc-VmuxjHBg6RMzfafFHtS8yrFU,140 +cv2/gapi/render/__init__.pyi,sha256=S4FWzy_CJqqs3dPYl3bXJoLQSGeVZdoBK7EmHvbPVOM,66 +cv2/gapi/render/ocv/__init__.pyi,sha256=MfRTDEPtcQekGnrvoaSSadxyylXPfa2lz8ucAkzjmh8,93 +cv2/gapi/streaming/__init__.pyi,sha256=qIOndKlPMevrSglTW-vVugzy_n7nITT6lr_zrlUv9cI,813 +cv2/gapi/video/__init__.pyi,sha256=V0Emspufw7x2-knfd7kE8LnLjY_ujIz_TaxR_oIyAps,150 +cv2/gapi/wip/__init__.pyi,sha256=f7mz60ehM9yrK0_Vt28NP--WietDE65EjM5O91LVx5M,1086 +cv2/gapi/wip/draw/__init__.pyi,sha256=x2BhywI5C-uMHF1H6L9AwrgjRtKHFr032TOnqtE9a9Q,3162 +cv2/gapi/wip/gst/__init__.pyi,sha256=8VtSKP9duTmY7ETAACwzVEWP9xdDW0pW82UtL_8Z7Aw,467 +cv2/gapi/wip/onevpl/__init__.pyi,sha256=eLbVPey7JCU5YdRSUH6lLlD1eT-1s7YqZrQh6xNdIlo,397 +cv2/ipp/__init__.pyi,sha256=WSHVIqIT97vmudtuJjhOJYiZ0iBdYx4AtB0iJqtdD0o,223 +cv2/load_config_py2.py,sha256=xP_h2pObzfbN8tONV7CAQmGh94fQ-0t0HysrXDDlt_Q,151 +cv2/load_config_py3.py,sha256=A9wfETdKZnybfbEN1SdtZAsMLVsueGa0zO93JzK9OFI,262 +cv2/mat_wrapper/__init__.py,sha256=LGhjbGujJyyQ4A5WOOtOES5WbbbpmP-_aHUPQ2Vvnec,1099 +cv2/mat_wrapper/__pycache__/__init__.cpython-38.pyc,, +cv2/misc/__init__.py,sha256=yr9PkxKslxRc87hhtIJRn5RommP9jaqksYr-ZDuj7cU,37 +cv2/misc/__pycache__/__init__.cpython-38.pyc,, +cv2/misc/__pycache__/version.cpython-38.pyc,, +cv2/misc/version.py,sha256=iTExq1jwGgAv3jtYQHRI8pSpmfzPsjkG9brsH0bdYhk,90 +cv2/ml/__init__.pyi,sha256=KGiSrNBU8YWqJzhV3owS_b_nKl_40EXwdGrmC1e41J4,22803 +cv2/ocl/__init__.pyi,sha256=HpZMIJBr7LcDWOvXAlfDd5aDzMCyDH3OVUcNtU6Zkfw,5455 +cv2/ogl/__init__.pyi,sha256=KxTX9DHYyXg2ipvOJiFeAsRivAjmvBkqeiLZV-0snII,1472 +cv2/parallel/__init__.pyi,sha256=tc5nNoWrTkD7VAfhbajumKF79LBolpqlKjYX-lY2__8,129 +cv2/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +cv2/qt/fonts/DejaVuSans-Bold.ttf,sha256=5JIhu_F8A2EnQUMWn35vFthxX2XUnx2fIW6z1mFAAwg,672300 +cv2/qt/fonts/DejaVuSans-BoldOblique.ttf,sha256=c1891zgbb04MpRm3JiDHWqlT7o7om4jL5POMo8I9ank,611212 +cv2/qt/fonts/DejaVuSans-ExtraLight.ttf,sha256=kI1uyALygVXI3oYZK1p3qftBeS8HLgNSbwU2wjTz6aA,345204 +cv2/qt/fonts/DejaVuSans-Oblique.ttf,sha256=O8nAL-_K3VF-WhWLLzQjPdNU1n9DAkhtiOhLykZ9HUM,611556 +cv2/qt/fonts/DejaVuSans.ttf,sha256=FdotjxLmlQABscyCJcG6ct3OGTiDfTdwL_Ppv215vV4,720012 +cv2/qt/fonts/DejaVuSansCondensed-Bold.ttf,sha256=-GxtQKUv_itA8Z0Llyykuc40f8BNz8TQtOkneocSwN0,631992 +cv2/qt/fonts/DejaVuSansCondensed-BoldOblique.ttf,sha256=ZldpOhjs7-4mZ9nQ7LGrtoUk1ieZm9g2UDnBngS0I4E,580168 +cv2/qt/fonts/DejaVuSansCondensed-Oblique.ttf,sha256=SPmU6BKEZmq0v4nvTXMIWwf65sLH4oggqyQ-mUHEgp4,576004 +cv2/qt/fonts/DejaVuSansCondensed.ttf,sha256=afE1XJ7vCj0RpsBvPL8dRuq_2tzJk1iaO-k6RO2GeLQ,643852 +cv2/qt/plugins/platforms/libqxcb.so,sha256=b2rHw7D7EZh7mHrUsrhrQYsQDiF0sFYEoPlJkSAFdjE,29305 +cv2/samples/__init__.pyi,sha256=cjSW5vo2oMpIWHwP-3IY4hWjlKUTz8gd1MX7pLOCWKo,324 +cv2/segmentation/__init__.pyi,sha256=jwKBUCRaXhHAM3FdzpLuGucGfNLWxWu5CDfLOpkcan4,1739 +cv2/typing/__init__.py,sha256=HoaylcwVD3ZH1MQ0oTxswFmYExDxFkS7sAWW6BWOUg4,5137 +cv2/typing/__pycache__/__init__.cpython-38.pyc,, +cv2/utils/__init__.py,sha256=fuw4GHHOXsxxKc-AadAEOKQq_I1Gr4G3yMlRvAbTP30,330 +cv2/utils/__init__.pyi,sha256=q7PpnVUH597R_sF7AGrsRVDOIGKflT0b77ll-mkmb7g,3592 +cv2/utils/__pycache__/__init__.cpython-38.pyc,, +cv2/utils/fs/__init__.pyi,sha256=lu2cK1Dbd7wRTOTju_kVVCvU4mNB5v5hSVpBxSXXvJg,87 +cv2/utils/nested/__init__.pyi,sha256=n2J3aSxC2MrPKaKb4igY_d49luuuQqW7A_YTx6eZz9Q,573 +cv2/version.py,sha256=zQjL6v-wBgcqGFq6XRAWaa39FmWEY4sLTKCZ3hptMlI,92 +cv2/videoio_registry/__init__.pyi,sha256=h-7AlM3cFG5xxcPwZiVQ3n3ibe7BpGPlhgDcWOqZPA4,783 +opencv_python-4.9.0.80.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +opencv_python-4.9.0.80.dist-info/LICENSE-3RD-PARTY.txt,sha256=ZKuaw_WkYDDW2Lvnl7aukYqNLQGG5HyiBLc0MbHrHMw,151157 +opencv_python-4.9.0.80.dist-info/LICENSE.txt,sha256=CdcZBY54Kse8cbohyUThE2zeK7lXwOiIEh8CGNa18Cw,1070 +opencv_python-4.9.0.80.dist-info/METADATA,sha256=4D_lTzaeG8QbRfiIFZ3bazaqGAHPb_09sMx-2sGJPeM,20251 +opencv_python-4.9.0.80.dist-info/RECORD,, +opencv_python-4.9.0.80.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +opencv_python-4.9.0.80.dist-info/WHEEL,sha256=EAtJEfUIJ_UiIhsbDQlddQslMIo1TSnut_vtG8YV5KA,142 +opencv_python-4.9.0.80.dist-info/top_level.txt,sha256=SY8vrf_sYOg99OP9euhz7q36pPy_2VK5vbeEWXwwSoc,4 +opencv_python.libs/libQt5Core-39545cc7.so.5.15.0,sha256=8bqvorqRNim_5obrAiVWgcIehuvtrDQJoykWMJecCVs,7333489 +opencv_python.libs/libQt5Gui-a7aedf18.so.5.15.0,sha256=_1PQrJUh1At_pGBnbLVhoKKObEU5CneH8jgSk5iyZOU,8856273 +opencv_python.libs/libQt5Test-c38a5234.so.5.15.0,sha256=ul3nnDMWl-Rqf3wtgIlxvcyDaR9t5MjxlYSssH2rZpE,419025 +opencv_python.libs/libQt5Widgets-e69d94fb.so.5.15.0,sha256=DHPfscZnGZ9rNQSDDdKfq0-96FuVq6V1xTLR7AuqGCY,8909633 +opencv_python.libs/libQt5XcbQpa-5b2d853e.so.5.15.0,sha256=lDdFucfIAfgXK3dA-pYKsYiCEnr0Fas3BZ1v0Wd3OWo,1796105 +opencv_python.libs/libX11-xcb-69166bdf.so.1.0.0,sha256=oIMXcY6MB8aPh8ogBGhuTdaxyFy06iw8-mTmO8o9WzU,8873 +opencv_python.libs/libXau-00ec42fe.so.6.0.0,sha256=JjysEtjYterX3CORw1X-n8k5lA4eoi7ZjuVqjLYc5oQ,17049 +opencv_python.libs/libavcodec-512f0acb.so.59.37.100,sha256=1rkzomPrXGOCDSOalbI613J191jX46XOmWT-kaRSr5E,13448513 +opencv_python.libs/libavformat-3ff1be5b.so.59.27.100,sha256=xxzCzbu3y-zOVzReNrHi53HygUswkSyV4hd6FGpbK_E,2571489 +opencv_python.libs/libavutil-a0a0531e.so.57.28.100,sha256=_HhiKqfwZH7fZ95HlYWD9p3ANOucUPLvqFPHvhxTq6Y,844673 +opencv_python.libs/libcrypto-0c9efecc.so.1.1,sha256=aQ4FPG5fBY-U4QjCcI7gc2DQ5dGkokgE9N6ZXkugD9s,3481345 +opencv_python.libs/libgfortran-91cc3cb1.so.3.0.0,sha256=VePrZzBsL_F-b4oIEOqg3LJulM2DkkxQZdUEDoeBRgg,1259665 +opencv_python.libs/libopenblas-r0-f650aae0.3.3.so,sha256=eewCtT9XPNcRaonwTDl0cwGOf9oFcgs1TUNQXBnUeVg,37325001 +opencv_python.libs/libpng16-7379b3c3.so.16.40.0,sha256=-ChEJT9joQEfhf4MZ0rIuU4N21x2VcTyBLh38q2m9ZA,1097009 +opencv_python.libs/libquadmath-96973f99.so.0.0.0,sha256=k0wi3tDn0WnE1GeIdslgUa3z2UVF2pYvYLQWWbB12js,247609 +opencv_python.libs/libssl-28bef1ac.so.1.1,sha256=3MoD1DoDL-u-QgZxgTrlZJpDvlPBflLEGO6RzVctbhE,736177 +opencv_python.libs/libswresample-2ec4394e.so.4.7.100,sha256=53S-M_Gn06zoAaUbYkdaMuLvXEWu2Mv1_YLkiW2oJ9I,132417 +opencv_python.libs/libswscale-2c3c8be7.so.6.7.100,sha256=Lp2HzwvDYmIHUUay0z4VqLo5jICmVQr3Z4uD1C1IXVA,619945 +opencv_python.libs/libvpx-e947aa05.so.8.0.1,sha256=WmdWKHzsqUpZZiaf6-C28vIJJ9CwK_yMkaR_eAz274g,3291065 +opencv_python.libs/libxcb-icccm-413c9f41.so.4.0.0,sha256=KrtUIHu46x9mIwMEkEYflhOFmYFjvUB3Ok1Dn9936eI,24377 +opencv_python.libs/libxcb-image-e82a276d.so.0.0.0,sha256=QYC_KsToCXKQ2u87uOb2WJmK6Z-S4yynjqYWiI3stTY,25601 +opencv_python.libs/libxcb-keysyms-21015570.so.1.0.0,sha256=PjX3WLcXNZucKONqtqBW4wPbmcaukPVyLPu2JCXZ7QQ,13209 +opencv_python.libs/libxcb-randr-a96a5a87.so.0.1.0,sha256=LZmVHqS5soTrAUfIJ4cy0BKHrBk0Q8cy7IBJFbhsHvY,93921 +opencv_python.libs/libxcb-render-637b984a.so.0.0.0,sha256=COOiubLk9Kv2S4wVA5QaRzgllJYpLLGXjYQAKM3hs2c,78105 +opencv_python.libs/libxcb-render-util-43ce00f5.so.0.0.0,sha256=N0OPbas7C-jZx7kb3--foJiJPc5odPSj-hdma1yRG2E,22161 +opencv_python.libs/libxcb-shape-25c2b258.so.0.0.0,sha256=8xHTe9DQmFzk-5HtT33th8bvgCroLJiEvXdAiN3i1io,21769 +opencv_python.libs/libxcb-shm-7a199f70.so.0.0.0,sha256=XrF9nlIKkNrLG9HkXnn_XIeIHPwr20hRrTWETbzVGwE,21377 +opencv_python.libs/libxcb-sync-89374f40.so.1.0.0,sha256=-w1wV0pfEQbSmW-QGzsRSADRNReahcQtlYgqIjKgHeE,35673 +opencv_python.libs/libxcb-util-4d666913.so.1.0.0,sha256=44mg7PRdg-AK2vHz0GT1yzW0iN8d_GUFvhFGlrLtMo8,26281 +opencv_python.libs/libxcb-xfixes-9be3ba6f.so.0.0.0,sha256=n5_94_1LwyIvg9S1I1dbu6a3ROBn28MQgT-maLnRtFM,45337 +opencv_python.libs/libxcb-xinerama-ae147f87.so.0.0.0,sha256=iUXAB0Ox6t7vVAJOQEzTK4GVjW3AbnHOFsWyxml6RNo,17529 +opencv_python.libs/libxcb-xkb-9ba31ab3.so.1.0.0,sha256=4toATK-D72nN4FjDv7ZCXjkMpU1Giroj5hr2ebVlOjk,157921 +opencv_python.libs/libxkbcommon-71ae2972.so.0.0.0,sha256=H8s4pka9HOHar2gq0pty5lv99noGM1snj46Z0LdTAhI,269865 +opencv_python.libs/libxkbcommon-x11-c65ed502.so.0.0.0,sha256=rW0xj4RCtgOJ1WRD7nOSLHXJdiSAPX0bafb8U52HQ4U,48105 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/REQUESTED b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/WHEEL b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..f1168dc846da196c3d37d4cf842a7360572a1a15 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: skbuild 0.17.6 +Root-Is-Purelib: false +Tag: cp37-abi3-manylinux_2_17_x86_64 +Tag: cp37-abi3-manylinux2014_x86_64 + diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/top_level.txt b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f372d8a15f09406879e280cf72b22712505404d --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/opencv_python-4.9.0.80.dist-info/top_level.txt @@ -0,0 +1 @@ +cv2 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pyasn1/__init__.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pyasn1/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5a56a707c8d025872651e7a99e2ce2dc1fe13ed6 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pyasn1/__init__.py @@ -0,0 +1,7 @@ +import sys + +# https://www.python.org/dev/peps/pep-0396/ +__version__ = '0.4.8' + +if sys.version_info[:2] < (2, 4): + raise RuntimeError('PyASN1 requires Python 2.4 or later') diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pyasn1/debug.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pyasn1/debug.py new file mode 100644 index 0000000000000000000000000000000000000000..8707aa887eb0b371bb27a5d2fa72d50fd0a17e42 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pyasn1/debug.py @@ -0,0 +1,157 @@ +# +# This file is part of pyasn1 software. +# +# Copyright (c) 2005-2019, Ilya Etingof +# License: http://snmplabs.com/pyasn1/license.html +# +import logging +import sys + +from pyasn1 import __version__ +from pyasn1 import error +from pyasn1.compat.octets import octs2ints + +__all__ = ['Debug', 'setLogger', 'hexdump'] + +DEBUG_NONE = 0x0000 +DEBUG_ENCODER = 0x0001 +DEBUG_DECODER = 0x0002 +DEBUG_ALL = 0xffff + +FLAG_MAP = { + 'none': DEBUG_NONE, + 'encoder': DEBUG_ENCODER, + 'decoder': DEBUG_DECODER, + 'all': DEBUG_ALL +} + +LOGGEE_MAP = {} + + +class Printer(object): + # noinspection PyShadowingNames + def __init__(self, logger=None, handler=None, formatter=None): + if logger is None: + logger = logging.getLogger('pyasn1') + + logger.setLevel(logging.DEBUG) + + if handler is None: + handler = logging.StreamHandler() + + if formatter is None: + formatter = logging.Formatter('%(asctime)s %(name)s: %(message)s') + + handler.setFormatter(formatter) + handler.setLevel(logging.DEBUG) + logger.addHandler(handler) + + self.__logger = logger + + def __call__(self, msg): + self.__logger.debug(msg) + + def __str__(self): + return '' + + +if hasattr(logging, 'NullHandler'): + NullHandler = logging.NullHandler + +else: + # Python 2.6 and older + class NullHandler(logging.Handler): + def emit(self, record): + pass + + +class Debug(object): + defaultPrinter = Printer() + + def __init__(self, *flags, **options): + self._flags = DEBUG_NONE + + if 'loggerName' in options: + # route our logs to parent logger + self._printer = Printer( + logger=logging.getLogger(options['loggerName']), + handler=NullHandler() + ) + + elif 'printer' in options: + self._printer = options.get('printer') + + else: + self._printer = self.defaultPrinter + + self._printer('running pyasn1 %s, debug flags %s' % (__version__, ', '.join(flags))) + + for flag in flags: + inverse = flag and flag[0] in ('!', '~') + if inverse: + flag = flag[1:] + try: + if inverse: + self._flags &= ~FLAG_MAP[flag] + else: + self._flags |= FLAG_MAP[flag] + except KeyError: + raise error.PyAsn1Error('bad debug flag %s' % flag) + + self._printer("debug category '%s' %s" % (flag, inverse and 'disabled' or 'enabled')) + + def __str__(self): + return 'logger %s, flags %x' % (self._printer, self._flags) + + def __call__(self, msg): + self._printer(msg) + + def __and__(self, flag): + return self._flags & flag + + def __rand__(self, flag): + return flag & self._flags + +_LOG = DEBUG_NONE + + +def setLogger(userLogger): + global _LOG + + if userLogger: + _LOG = userLogger + else: + _LOG = DEBUG_NONE + + # Update registered logging clients + for module, (name, flags) in LOGGEE_MAP.items(): + setattr(module, name, _LOG & flags and _LOG or DEBUG_NONE) + + +def registerLoggee(module, name='LOG', flags=DEBUG_NONE): + LOGGEE_MAP[sys.modules[module]] = name, flags + setLogger(_LOG) + return _LOG + + +def hexdump(octets): + return ' '.join( + ['%s%.2X' % (n % 16 == 0 and ('\n%.5d: ' % n) or '', x) + for n, x in zip(range(len(octets)), octs2ints(octets))] + ) + + +class Scope(object): + def __init__(self): + self._list = [] + + def __str__(self): return '.'.join(self._list) + + def push(self, token): + self._list.append(token) + + def pop(self): + return self._list.pop() + + +scope = Scope() diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pyasn1/error.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pyasn1/error.py new file mode 100644 index 0000000000000000000000000000000000000000..4f48db2516b3752d269ccb46c5dee7e452fef63e --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pyasn1/error.py @@ -0,0 +1,75 @@ +# +# This file is part of pyasn1 software. +# +# Copyright (c) 2005-2019, Ilya Etingof +# License: http://snmplabs.com/pyasn1/license.html +# + + +class PyAsn1Error(Exception): + """Base pyasn1 exception + + `PyAsn1Error` is the base exception class (based on + :class:`Exception`) that represents all possible ASN.1 related + errors. + """ + + +class ValueConstraintError(PyAsn1Error): + """ASN.1 type constraints violation exception + + The `ValueConstraintError` exception indicates an ASN.1 value + constraint violation. + + It might happen on value object instantiation (for scalar types) or on + serialization (for constructed types). + """ + + +class SubstrateUnderrunError(PyAsn1Error): + """ASN.1 data structure deserialization error + + The `SubstrateUnderrunError` exception indicates insufficient serialised + data on input of a de-serialization codec. + """ + + +class PyAsn1UnicodeError(PyAsn1Error, UnicodeError): + """Unicode text processing error + + The `PyAsn1UnicodeError` exception is a base class for errors relating to + unicode text de/serialization. + + Apart from inheriting from :class:`PyAsn1Error`, it also inherits from + :class:`UnicodeError` to help the caller catching unicode-related errors. + """ + def __init__(self, message, unicode_error=None): + if isinstance(unicode_error, UnicodeError): + UnicodeError.__init__(self, *unicode_error.args) + PyAsn1Error.__init__(self, message) + + +class PyAsn1UnicodeDecodeError(PyAsn1UnicodeError, UnicodeDecodeError): + """Unicode text decoding error + + The `PyAsn1UnicodeDecodeError` exception represents a failure to + deserialize unicode text. + + Apart from inheriting from :class:`PyAsn1UnicodeError`, it also inherits + from :class:`UnicodeDecodeError` to help the caller catching unicode-related + errors. + """ + + +class PyAsn1UnicodeEncodeError(PyAsn1UnicodeError, UnicodeEncodeError): + """Unicode text encoding error + + The `PyAsn1UnicodeEncodeError` exception represents a failure to + serialize unicode text. + + Apart from inheriting from :class:`PyAsn1UnicodeError`, it also inherits + from :class:`UnicodeEncodeError` to help the caller catching + unicode-related errors. + """ + + diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/__init__.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3720f5504cf27c79f4a1598da99a1f0f40a5047a --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/__init__.py @@ -0,0 +1,40 @@ +# flake8: noqa + +# Copyright (c) 2006-2012 Filip Wasilewski +# Copyright (c) 2012-2020 The PyWavelets Developers +# +# See LICENSE for more details. + +""" +Discrete forward and inverse wavelet transform, stationary wavelet transform, +wavelet packets signal decomposition and reconstruction module. +""" + +from __future__ import division, print_function, absolute_import + +from ._extensions._pywt import * +from ._functions import * +from ._multilevel import * +from ._multidim import * +from ._thresholding import * +from ._wavelet_packets import * +from ._dwt import * +from ._swt import * +from ._cwt import * +from ._mra import * + +from . import data + +__all__ = [s for s in dir() if not s.startswith('_')] +try: + # In Python 2.x the name of the tempvar leaks out of the list + # comprehension. Delete it to not make it show up in the main namespace. + del s +except NameError: + pass + +from pywt.version import version as __version__ + +from ._pytesttester import PytestTester +test = PytestTester(__name__) +del PytestTester diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_c99_config.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_c99_config.py new file mode 100644 index 0000000000000000000000000000000000000000..a969ba3ea52042c3805a6a5a7f724fce56cc5ac9 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_c99_config.py @@ -0,0 +1,3 @@ +# Autogenerated file containing compile-time definitions + +_have_c99_complex = 1 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_cwt.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_cwt.py new file mode 100644 index 0000000000000000000000000000000000000000..34e3b24fdf6b95a3588c3f855e6af1e7131483fa --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_cwt.py @@ -0,0 +1,203 @@ +from math import floor, ceil + +from ._extensions._pywt import (DiscreteContinuousWavelet, ContinuousWavelet, + Wavelet, _check_dtype) +from ._functions import integrate_wavelet, scale2frequency + + +__all__ = ["cwt"] + + +import numpy as np + +try: + # Prefer scipy.fft (new in SciPy 1.4) + import scipy.fft + fftmodule = scipy.fft + next_fast_len = fftmodule.next_fast_len +except ImportError: + try: + import scipy.fftpack + fftmodule = scipy.fftpack + next_fast_len = fftmodule.next_fast_len + except ImportError: + fftmodule = np.fft + + # provide a fallback so scipy is an optional requirement + def next_fast_len(n): + """Round up size to the nearest power of two. + + Given a number of samples `n`, returns the next power of two + following this number to take advantage of FFT speedup. + This fallback is less efficient than `scipy.fftpack.next_fast_len` + """ + return 2**ceil(np.log2(n)) + + +def cwt(data, scales, wavelet, sampling_period=1., method='conv', axis=-1): + """ + cwt(data, scales, wavelet) + + One dimensional Continuous Wavelet Transform. + + Parameters + ---------- + data : array_like + Input signal + scales : array_like + The wavelet scales to use. One can use + ``f = scale2frequency(wavelet, scale)/sampling_period`` to determine + what physical frequency, ``f``. Here, ``f`` is in hertz when the + ``sampling_period`` is given in seconds. + wavelet : Wavelet object or name + Wavelet to use + sampling_period : float + Sampling period for the frequencies output (optional). + The values computed for ``coefs`` are independent of the choice of + ``sampling_period`` (i.e. ``scales`` is not scaled by the sampling + period). + method : {'conv', 'fft'}, optional + The method used to compute the CWT. Can be any of: + - ``conv`` uses ``numpy.convolve``. + - ``fft`` uses frequency domain convolution. + - ``auto`` uses automatic selection based on an estimate of the + computational complexity at each scale. + + The ``conv`` method complexity is ``O(len(scale) * len(data))``. + The ``fft`` method is ``O(N * log2(N))`` with + ``N = len(scale) + len(data) - 1``. It is well suited for large size + signals but slightly slower than ``conv`` on small ones. + axis: int, optional + Axis over which to compute the CWT. If not given, the last axis is + used. + + Returns + ------- + coefs : array_like + Continuous wavelet transform of the input signal for the given scales + and wavelet. The first axis of ``coefs`` corresponds to the scales. + The remaining axes match the shape of ``data``. + frequencies : array_like + If the unit of sampling period are seconds and given, than frequencies + are in hertz. Otherwise, a sampling period of 1 is assumed. + + Notes + ----- + Size of coefficients arrays depends on the length of the input array and + the length of given scales. + + Examples + -------- + >>> import pywt + >>> import numpy as np + >>> import matplotlib.pyplot as plt + >>> x = np.arange(512) + >>> y = np.sin(2*np.pi*x/32) + >>> coef, freqs=pywt.cwt(y,np.arange(1,129),'gaus1') + >>> plt.matshow(coef) # doctest: +SKIP + >>> plt.show() # doctest: +SKIP + ---------- + >>> import pywt + >>> import numpy as np + >>> import matplotlib.pyplot as plt + >>> t = np.linspace(-1, 1, 200, endpoint=False) + >>> sig = np.cos(2 * np.pi * 7 * t) + np.real(np.exp(-7*(t-0.4)**2)*np.exp(1j*2*np.pi*2*(t-0.4))) + >>> widths = np.arange(1, 31) + >>> cwtmatr, freqs = pywt.cwt(sig, widths, 'mexh') + >>> plt.imshow(cwtmatr, extent=[-1, 1, 1, 31], cmap='PRGn', aspect='auto', + ... vmax=abs(cwtmatr).max(), vmin=-abs(cwtmatr).max()) # doctest: +SKIP + >>> plt.show() # doctest: +SKIP + """ + + # accept array_like input; make a copy to ensure a contiguous array + dt = _check_dtype(data) + data = np.asarray(data, dtype=dt) + dt_cplx = np.result_type(dt, np.complex64) + if not isinstance(wavelet, (ContinuousWavelet, Wavelet)): + wavelet = DiscreteContinuousWavelet(wavelet) + if np.isscalar(scales): + scales = np.array([scales]) + if not np.isscalar(axis): + raise np.AxisError("axis must be a scalar.") + + dt_out = dt_cplx if wavelet.complex_cwt else dt + out = np.empty((np.size(scales),) + data.shape, dtype=dt_out) + precision = 10 + int_psi, x = integrate_wavelet(wavelet, precision=precision) + int_psi = np.conj(int_psi) if wavelet.complex_cwt else int_psi + + # convert int_psi, x to the same precision as the data + dt_psi = dt_cplx if int_psi.dtype.kind == 'c' else dt + int_psi = np.asarray(int_psi, dtype=dt_psi) + x = np.asarray(x, dtype=data.real.dtype) + + if method == 'fft': + size_scale0 = -1 + fft_data = None + elif not method == 'conv': + raise ValueError("method must be 'conv' or 'fft'") + + if data.ndim > 1: + # move axis to be transformed last (so it is contiguous) + data = data.swapaxes(-1, axis) + + # reshape to (n_batch, data.shape[-1]) + data_shape_pre = data.shape + data = data.reshape((-1, data.shape[-1])) + + for i, scale in enumerate(scales): + step = x[1] - x[0] + j = np.arange(scale * (x[-1] - x[0]) + 1) / (scale * step) + j = j.astype(int) # floor + if j[-1] >= int_psi.size: + j = np.extract(j < int_psi.size, j) + int_psi_scale = int_psi[j][::-1] + + if method == 'conv': + if data.ndim == 1: + conv = np.convolve(data, int_psi_scale) + else: + # batch convolution via loop + conv_shape = list(data.shape) + conv_shape[-1] += int_psi_scale.size - 1 + conv_shape = tuple(conv_shape) + conv = np.empty(conv_shape, dtype=dt_out) + for n in range(data.shape[0]): + conv[n, :] = np.convolve(data[n], int_psi_scale) + else: + # The padding is selected for: + # - optimal FFT complexity + # - to be larger than the two signals length to avoid circular + # convolution + size_scale = next_fast_len( + data.shape[-1] + int_psi_scale.size - 1 + ) + if size_scale != size_scale0: + # Must recompute fft_data when the padding size changes. + fft_data = fftmodule.fft(data, size_scale, axis=-1) + size_scale0 = size_scale + fft_wav = fftmodule.fft(int_psi_scale, size_scale, axis=-1) + conv = fftmodule.ifft(fft_wav * fft_data, axis=-1) + conv = conv[..., :data.shape[-1] + int_psi_scale.size - 1] + + coef = - np.sqrt(scale) * np.diff(conv, axis=-1) + if out.dtype.kind != 'c': + coef = coef.real + # transform axis is always -1 due to the data reshape above + d = (coef.shape[-1] - data.shape[-1]) / 2. + if d > 0: + coef = coef[..., floor(d):-ceil(d)] + elif d < 0: + raise ValueError( + "Selected scale of {} too small.".format(scale)) + if data.ndim > 1: + # restore original data shape and axis position + coef = coef.reshape(data_shape_pre) + coef = coef.swapaxes(axis, -1) + out[i, ...] = coef + + frequencies = scale2frequency(wavelet, scales, precision) + if np.isscalar(frequencies): + frequencies = np.array([frequencies]) + frequencies /= sampling_period + return out, frequencies diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_doc_utils.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_doc_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..ee906aeabd2d1b10f14222be1c2e643d48feb368 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_doc_utils.py @@ -0,0 +1,187 @@ +"""Utilities used to generate various figures in the documentation.""" +from itertools import product + +import numpy as np +from matplotlib import pyplot as plt + +from ._dwt import pad + +__all__ = ['wavedec_keys', 'wavedec2_keys', 'draw_2d_wp_basis', + 'draw_2d_fswavedecn_basis', 'boundary_mode_subplot'] + + +def wavedec_keys(level): + """Subband keys corresponding to a wavedec decomposition.""" + approx = '' + coeffs = {} + for lev in range(level): + for k in ['a', 'd']: + coeffs[approx + k] = None + approx = 'a' * (lev + 1) + if lev < level - 1: + coeffs.pop(approx) + return list(coeffs.keys()) + + +def wavedec2_keys(level): + """Subband keys corresponding to a wavedec2 decomposition.""" + approx = '' + coeffs = {} + for lev in range(level): + for k in ['a', 'h', 'v', 'd']: + coeffs[approx + k] = None + approx = 'a' * (lev + 1) + if lev < level - 1: + coeffs.pop(approx) + return list(coeffs.keys()) + + +def _box(bl, ur): + """(x, y) coordinates for the 4 lines making up a rectangular box. + + Parameters + ========== + bl : float + The bottom left corner of the box + ur : float + The upper right corner of the box + + Returns + ======= + coords : 2-tuple + The first and second elements of the tuple are the x and y coordinates + of the box. + """ + xl, xr = bl[0], ur[0] + yb, yt = bl[1], ur[1] + box_x = [xl, xr, + xr, xr, + xr, xl, + xl, xl] + box_y = [yb, yb, + yb, yt, + yt, yt, + yt, yb] + return (box_x, box_y) + + +def _2d_wp_basis_coords(shape, keys): + # Coordinates of the lines to be drawn by draw_2d_wp_basis + coords = [] + centers = {} # retain center of boxes for use in labeling + for key in keys: + offset_x = offset_y = 0 + for n, char in enumerate(key): + if char in ['h', 'd']: + offset_x += shape[0] // 2**(n + 1) + if char in ['v', 'd']: + offset_y += shape[1] // 2**(n + 1) + sx = shape[0] // 2**(n + 1) + sy = shape[1] // 2**(n + 1) + xc, yc = _box((offset_x, -offset_y), + (offset_x + sx, -offset_y - sy)) + coords.append((xc, yc)) + centers[key] = (offset_x + sx // 2, -offset_y - sy // 2) + return coords, centers + + +def draw_2d_wp_basis(shape, keys, fmt='k', plot_kwargs={}, ax=None, + label_levels=0): + """Plot a 2D representation of a WaveletPacket2D basis.""" + coords, centers = _2d_wp_basis_coords(shape, keys) + if ax is None: + fig, ax = plt.subplots(1, 1) + else: + fig = ax.get_figure() + for coord in coords: + ax.plot(coord[0], coord[1], fmt) + ax.set_axis_off() + ax.axis('square') + if label_levels > 0: + for key, c in centers.items(): + if len(key) <= label_levels: + ax.text(c[0], c[1], key, + horizontalalignment='center', + verticalalignment='center') + return fig, ax + + +def _2d_fswavedecn_coords(shape, levels): + coords = [] + centers = {} # retain center of boxes for use in labeling + for key in product(wavedec_keys(levels), repeat=2): + (key0, key1) = key + offsets = [0, 0] + widths = list(shape) + for n0, char in enumerate(key0): + if char in ['d']: + offsets[0] += shape[0] // 2**(n0 + 1) + for n1, char in enumerate(key1): + if char in ['d']: + offsets[1] += shape[1] // 2**(n1 + 1) + widths[0] = shape[0] // 2**(n0 + 1) + widths[1] = shape[1] // 2**(n1 + 1) + xc, yc = _box((offsets[0], -offsets[1]), + (offsets[0] + widths[0], -offsets[1] - widths[1])) + coords.append((xc, yc)) + centers[(key0, key1)] = (offsets[0] + widths[0] / 2, + -offsets[1] - widths[1] / 2) + return coords, centers + + +def draw_2d_fswavedecn_basis(shape, levels, fmt='k', plot_kwargs={}, ax=None, + label_levels=0): + """Plot a 2D representation of a WaveletPacket2D basis.""" + coords, centers = _2d_fswavedecn_coords(shape, levels) + if ax is None: + fig, ax = plt.subplots(1, 1) + else: + fig = ax.get_figure() + for coord in coords: + ax.plot(coord[0], coord[1], fmt) + ax.set_axis_off() + ax.axis('square') + if label_levels > 0: + for key, c in centers.items(): + lev = np.max([len(k) for k in key]) + if lev <= label_levels: + ax.text(c[0], c[1], key, + horizontalalignment='center', + verticalalignment='center') + return fig, ax + + +def boundary_mode_subplot(x, mode, ax, symw=True): + """Plot an illustration of the boundary mode in a subplot axis.""" + + # if odd-length, periodization replicates the last sample to make it even + if mode == 'periodization' and len(x) % 2 == 1: + x = np.concatenate((x, (x[-1], ))) + + npad = 2 * len(x) + t = np.arange(len(x) + 2 * npad) + xp = pad(x, (npad, npad), mode=mode) + + ax.plot(t, xp, 'k.') + ax.set_title(mode) + + # plot the original signal in red + if mode == 'periodization': + ax.plot(t[npad:npad + len(x) - 1], x[:-1], 'r.') + else: + ax.plot(t[npad:npad + len(x)], x, 'r.') + + # add vertical bars indicating points of symmetry or boundary extension + o2 = np.ones(2) + left = npad + if symw: + step = len(x) - 1 + rng = range(-2, 4) + else: + left -= 0.5 + step = len(x) + rng = range(-2, 4) + if mode in ['smooth', 'constant', 'zero']: + rng = range(0, 2) + for rep in rng: + ax.plot((left + rep * step) * o2, [xp.min() - .5, xp.max() + .5], 'k-') diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_dwt.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_dwt.py new file mode 100644 index 0000000000000000000000000000000000000000..86beb637d0318c682e56f76b399688320ee5e936 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_dwt.py @@ -0,0 +1,517 @@ +from numbers import Number + +import numpy as np + +from ._c99_config import _have_c99_complex +from ._extensions._pywt import Wavelet, Modes, _check_dtype, wavelist +from ._extensions._dwt import (dwt_single, dwt_axis, idwt_single, idwt_axis, + upcoef as _upcoef, downcoef as _downcoef, + dwt_max_level as _dwt_max_level, + dwt_coeff_len as _dwt_coeff_len) +from ._utils import string_types, _as_wavelet + + +__all__ = ["dwt", "idwt", "downcoef", "upcoef", "dwt_max_level", + "dwt_coeff_len", "pad"] + + +def dwt_max_level(data_len, filter_len): + r""" + dwt_max_level(data_len, filter_len) + + Compute the maximum useful level of decomposition. + + Parameters + ---------- + data_len : int + Input data length. + filter_len : int, str or Wavelet + The wavelet filter length. Alternatively, the name of a discrete + wavelet or a Wavelet object can be specified. + + Returns + ------- + max_level : int + Maximum level. + + Notes + ----- + The rational for the choice of levels is the maximum level where at least + one coefficient in the output is uncorrupted by edge effects caused by + signal extension. Put another way, decomposition stops when the signal + becomes shorter than the FIR filter length for a given wavelet. This + corresponds to: + + .. max_level = floor(log2(data_len/(filter_len - 1))) + + .. math:: + \mathtt{max\_level} = \left\lfloor\log_2\left(\mathtt{ + \frac{data\_len}{filter\_len - 1}}\right)\right\rfloor + + Examples + -------- + >>> import pywt + >>> w = pywt.Wavelet('sym5') + >>> pywt.dwt_max_level(data_len=1000, filter_len=w.dec_len) + 6 + >>> pywt.dwt_max_level(1000, w) + 6 + >>> pywt.dwt_max_level(1000, 'sym5') + 6 + """ + if isinstance(filter_len, Wavelet): + filter_len = filter_len.dec_len + elif isinstance(filter_len, string_types): + if filter_len in wavelist(kind='discrete'): + filter_len = Wavelet(filter_len).dec_len + else: + raise ValueError( + ("'{}', is not a recognized discrete wavelet. A list of " + "supported wavelet names can be obtained via " + "pywt.wavelist(kind='discrete')").format(filter_len)) + elif not (isinstance(filter_len, Number) and filter_len % 1 == 0): + raise ValueError( + "filter_len must be an integer, discrete Wavelet object, or the " + "name of a discrete wavelet.") + + if filter_len < 2: + raise ValueError("invalid wavelet filter length") + + return _dwt_max_level(data_len, filter_len) + + +def dwt_coeff_len(data_len, filter_len, mode): + """ + dwt_coeff_len(data_len, filter_len, mode='symmetric') + + Returns length of dwt output for given data length, filter length and mode + + Parameters + ---------- + data_len : int + Data length. + filter_len : int + Filter length. + mode : str, optional + Signal extension mode, see :ref:`Modes `. + + Returns + ------- + len : int + Length of dwt output. + + Notes + ----- + For all modes except periodization:: + + len(cA) == len(cD) == floor((len(data) + wavelet.dec_len - 1) / 2) + + for periodization mode ("per"):: + + len(cA) == len(cD) == ceil(len(data) / 2) + + """ + if isinstance(filter_len, Wavelet): + filter_len = filter_len.dec_len + + return _dwt_coeff_len(data_len, filter_len, Modes.from_object(mode)) + + +def dwt(data, wavelet, mode='symmetric', axis=-1): + """ + dwt(data, wavelet, mode='symmetric', axis=-1) + + Single level Discrete Wavelet Transform. + + Parameters + ---------- + data : array_like + Input signal + wavelet : Wavelet object or name + Wavelet to use + mode : str, optional + Signal extension mode, see :ref:`Modes `. + axis: int, optional + Axis over which to compute the DWT. If not given, the + last axis is used. + + Returns + ------- + (cA, cD) : tuple + Approximation and detail coefficients. + + Notes + ----- + Length of coefficients arrays depends on the selected mode. + For all modes except periodization: + + ``len(cA) == len(cD) == floor((len(data) + wavelet.dec_len - 1) / 2)`` + + For periodization mode ("per"): + + ``len(cA) == len(cD) == ceil(len(data) / 2)`` + + Examples + -------- + >>> import pywt + >>> (cA, cD) = pywt.dwt([1, 2, 3, 4, 5, 6], 'db1') + >>> cA + array([ 2.12132034, 4.94974747, 7.77817459]) + >>> cD + array([-0.70710678, -0.70710678, -0.70710678]) + + """ + if not _have_c99_complex and np.iscomplexobj(data): + data = np.asarray(data) + cA_r, cD_r = dwt(data.real, wavelet, mode, axis) + cA_i, cD_i = dwt(data.imag, wavelet, mode, axis) + return (cA_r + 1j*cA_i, cD_r + 1j*cD_i) + + # accept array_like input; make a copy to ensure a contiguous array + dt = _check_dtype(data) + data = np.asarray(data, dtype=dt, order='C') + mode = Modes.from_object(mode) + wavelet = _as_wavelet(wavelet) + + if axis < 0: + axis = axis + data.ndim + if not 0 <= axis < data.ndim: + raise np.AxisError("Axis greater than data dimensions") + + if data.ndim == 1: + cA, cD = dwt_single(data, wavelet, mode) + # TODO: Check whether this makes a copy + cA, cD = np.asarray(cA, dt), np.asarray(cD, dt) + else: + cA, cD = dwt_axis(data, wavelet, mode, axis=axis) + + return (cA, cD) + + +def idwt(cA, cD, wavelet, mode='symmetric', axis=-1): + """ + idwt(cA, cD, wavelet, mode='symmetric', axis=-1) + + Single level Inverse Discrete Wavelet Transform. + + Parameters + ---------- + cA : array_like or None + Approximation coefficients. If None, will be set to array of zeros + with same shape as ``cD``. + cD : array_like or None + Detail coefficients. If None, will be set to array of zeros + with same shape as ``cA``. + wavelet : Wavelet object or name + Wavelet to use + mode : str, optional (default: 'symmetric') + Signal extension mode, see :ref:`Modes `. + axis: int, optional + Axis over which to compute the inverse DWT. If not given, the + last axis is used. + + Returns + ------- + rec: array_like + Single level reconstruction of signal from given coefficients. + + Examples + -------- + >>> import pywt + >>> (cA, cD) = pywt.dwt([1,2,3,4,5,6], 'db2', 'smooth') + >>> pywt.idwt(cA, cD, 'db2', 'smooth') + array([ 1., 2., 3., 4., 5., 6.]) + + One of the neat features of ``idwt`` is that one of the ``cA`` and ``cD`` + arguments can be set to None. In that situation the reconstruction will be + performed using only the other one. Mathematically speaking, this is + equivalent to passing a zero-filled array as one of the arguments. + + >>> (cA, cD) = pywt.dwt([1,2,3,4,5,6], 'db2', 'smooth') + >>> A = pywt.idwt(cA, None, 'db2', 'smooth') + >>> D = pywt.idwt(None, cD, 'db2', 'smooth') + >>> A + D + array([ 1., 2., 3., 4., 5., 6.]) + + """ + # TODO: Lots of possible allocations to eliminate (zeros_like, asarray(rec)) + # accept array_like input; make a copy to ensure a contiguous array + + if cA is None and cD is None: + raise ValueError("At least one coefficient parameter must be " + "specified.") + + # for complex inputs: compute real and imaginary separately then combine + if not _have_c99_complex and (np.iscomplexobj(cA) or np.iscomplexobj(cD)): + if cA is None: + cD = np.asarray(cD) + cA = np.zeros_like(cD) + elif cD is None: + cA = np.asarray(cA) + cD = np.zeros_like(cA) + return (idwt(cA.real, cD.real, wavelet, mode, axis) + + 1j*idwt(cA.imag, cD.imag, wavelet, mode, axis)) + + if cA is not None: + dt = _check_dtype(cA) + cA = np.asarray(cA, dtype=dt, order='C') + if cD is not None: + dt = _check_dtype(cD) + cD = np.asarray(cD, dtype=dt, order='C') + + if cA is not None and cD is not None: + if cA.dtype != cD.dtype: + # need to upcast to common type + if cA.dtype.kind == 'c' or cD.dtype.kind == 'c': + dtype = np.complex128 + else: + dtype = np.float64 + cA = cA.astype(dtype) + cD = cD.astype(dtype) + elif cA is None: + cA = np.zeros_like(cD) + elif cD is None: + cD = np.zeros_like(cA) + + # cA and cD should be same dimension by here + ndim = cA.ndim + + mode = Modes.from_object(mode) + wavelet = _as_wavelet(wavelet) + + if axis < 0: + axis = axis + ndim + if not 0 <= axis < ndim: + raise np.AxisError("Axis greater than coefficient dimensions") + + if ndim == 1: + rec = idwt_single(cA, cD, wavelet, mode) + else: + rec = idwt_axis(cA, cD, wavelet, mode, axis=axis) + + return rec + + +def downcoef(part, data, wavelet, mode='symmetric', level=1): + """ + downcoef(part, data, wavelet, mode='symmetric', level=1) + + Partial Discrete Wavelet Transform data decomposition. + + Similar to ``pywt.dwt``, but computes only one set of coefficients. + Useful when you need only approximation or only details at the given level. + + Parameters + ---------- + part : str + Coefficients type: + + * 'a' - approximations reconstruction is performed + * 'd' - details reconstruction is performed + + data : array_like + Input signal. + wavelet : Wavelet object or name + Wavelet to use + mode : str, optional + Signal extension mode, see :ref:`Modes `. + level : int, optional + Decomposition level. Default is 1. + + Returns + ------- + coeffs : ndarray + 1-D array of coefficients. + + See Also + -------- + upcoef + + """ + if not _have_c99_complex and np.iscomplexobj(data): + return (downcoef(part, data.real, wavelet, mode, level) + + 1j*downcoef(part, data.imag, wavelet, mode, level)) + # accept array_like input; make a copy to ensure a contiguous array + dt = _check_dtype(data) + data = np.asarray(data, dtype=dt, order='C') + if data.ndim > 1: + raise ValueError("downcoef only supports 1d data.") + if part not in 'ad': + raise ValueError("Argument 1 must be 'a' or 'd', not '%s'." % part) + mode = Modes.from_object(mode) + wavelet = _as_wavelet(wavelet) + return np.asarray(_downcoef(part == 'a', data, wavelet, mode, level)) + + +def upcoef(part, coeffs, wavelet, level=1, take=0): + """ + upcoef(part, coeffs, wavelet, level=1, take=0) + + Direct reconstruction from coefficients. + + Parameters + ---------- + part : str + Coefficients type: + * 'a' - approximations reconstruction is performed + * 'd' - details reconstruction is performed + coeffs : array_like + Coefficients array to recontruct + wavelet : Wavelet object or name + Wavelet to use + level : int, optional + Multilevel reconstruction level. Default is 1. + take : int, optional + Take central part of length equal to 'take' from the result. + Default is 0. + + Returns + ------- + rec : ndarray + 1-D array with reconstructed data from coefficients. + + See Also + -------- + downcoef + + Examples + -------- + >>> import pywt + >>> data = [1,2,3,4,5,6] + >>> (cA, cD) = pywt.dwt(data, 'db2', 'smooth') + >>> pywt.upcoef('a', cA, 'db2') + pywt.upcoef('d', cD, 'db2') + array([-0.25 , -0.4330127 , 1. , 2. , 3. , + 4. , 5. , 6. , 1.78589838, -1.03108891]) + >>> n = len(data) + >>> pywt.upcoef('a', cA, 'db2', take=n) + pywt.upcoef('d', cD, 'db2', take=n) + array([ 1., 2., 3., 4., 5., 6.]) + + """ + if not _have_c99_complex and np.iscomplexobj(coeffs): + return (upcoef(part, coeffs.real, wavelet, level, take) + + 1j*upcoef(part, coeffs.imag, wavelet, level, take)) + # accept array_like input; make a copy to ensure a contiguous array + dt = _check_dtype(coeffs) + coeffs = np.asarray(coeffs, dtype=dt, order='C') + if coeffs.ndim > 1: + raise ValueError("upcoef only supports 1d coeffs.") + wavelet = _as_wavelet(wavelet) + if part not in 'ad': + raise ValueError("Argument 1 must be 'a' or 'd', not '%s'." % part) + return np.asarray(_upcoef(part == 'a', coeffs, wavelet, level, take)) + + +def pad(x, pad_widths, mode): + """Extend a 1D signal using a given boundary mode. + + This function operates like :func:`numpy.pad` but supports all signal + extension modes that can be used by PyWavelets discrete wavelet transforms. + + Parameters + ---------- + x : ndarray + The array to pad + pad_widths : {sequence, array_like, int} + Number of values padded to the edges of each axis. + ``((before_1, after_1), … (before_N, after_N))`` unique pad widths for + each axis. ``((before, after),)`` yields same before and after pad for + each axis. ``(pad,)`` or int is a shortcut for + ``before = after = pad width`` for all axes. + mode : str, optional + Signal extension mode, see :ref:`Modes `. + + Returns + ------- + pad : ndarray + Padded array of rank equal to array with shape increased according to + ``pad_widths``. + + Notes + ----- + The performance of padding in dimensions > 1 may be substantially slower + for modes ``'smooth'`` and ``'antisymmetric'`` as these modes are not + supported efficiently by the underlying :func:`numpy.pad` function. + + Note that the behavior of the ``'constant'`` mode here follows the + PyWavelets convention which is different from NumPy (it is equivalent to + ``mode='edge'`` in :func:`numpy.pad`). + """ + x = np.asanyarray(x) + + # process pad_widths exactly as in numpy.pad + pad_widths = np.array(pad_widths) + pad_widths = np.round(pad_widths).astype(np.intp, copy=False) + if pad_widths.min() < 0: + raise ValueError("pad_widths must be > 0") + pad_widths = np.broadcast_to(pad_widths, (x.ndim, 2)).tolist() + + if mode in ['symmetric', 'reflect']: + xp = np.pad(x, pad_widths, mode=mode) + elif mode in ['periodic', 'periodization']: + if mode == 'periodization': + # Promote odd-sized dimensions to even length by duplicating the + # last value. + edge_pad_widths = [(0, x.shape[ax] % 2) + for ax in range(x.ndim)] + x = np.pad(x, edge_pad_widths, mode='edge') + xp = np.pad(x, pad_widths, mode='wrap') + elif mode == 'zero': + xp = np.pad(x, pad_widths, mode='constant', constant_values=0) + elif mode == 'constant': + xp = np.pad(x, pad_widths, mode='edge') + elif mode == 'smooth': + def pad_smooth(vector, pad_width, iaxis, kwargs): + # smooth extension to left + left = vector[pad_width[0]] + slope_left = (left - vector[pad_width[0] + 1]) + vector[:pad_width[0]] = \ + left + np.arange(pad_width[0], 0, -1) * slope_left + + # smooth extension to right + right = vector[-pad_width[1] - 1] + slope_right = (right - vector[-pad_width[1] - 2]) + vector[-pad_width[1]:] = \ + right + np.arange(1, pad_width[1] + 1) * slope_right + return vector + xp = np.pad(x, pad_widths, pad_smooth) + elif mode == 'antisymmetric': + def pad_antisymmetric(vector, pad_width, iaxis, kwargs): + # smooth extension to left + # implement by flipping portions symmetric padding + npad_l, npad_r = pad_width + vsize_nonpad = vector.size - npad_l - npad_r + # Note: must modify vector in-place + vector[:] = np.pad(vector[pad_width[0]:-pad_width[-1]], + pad_width, mode='symmetric') + vp = vector + r_edge = npad_l + vsize_nonpad - 1 + l_edge = npad_l + # width of each reflected segment + seg_width = vsize_nonpad + # flip reflected segments on the right of the original signal + n = 1 + while r_edge <= vp.size: + segment_slice = slice(r_edge + 1, + min(r_edge + 1 + seg_width, vp.size)) + if n % 2: + vp[segment_slice] *= -1 + r_edge += seg_width + n += 1 + + # flip reflected segments on the left of the original signal + n = 1 + while l_edge >= 0: + segment_slice = slice(max(0, l_edge - seg_width), l_edge) + if n % 2: + vp[segment_slice] *= -1 + l_edge -= seg_width + n += 1 + return vector + xp = np.pad(x, pad_widths, pad_antisymmetric) + elif mode == 'antireflect': + xp = np.pad(x, pad_widths, mode='reflect', reflect_type='odd') + else: + raise ValueError( + ("unsupported mode: {}. The supported modes are {}").format( + mode, Modes.modes)) + return xp diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_functions.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_functions.py new file mode 100644 index 0000000000000000000000000000000000000000..86033967aab3050921737e60ddfe7793af2887c4 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_functions.py @@ -0,0 +1,240 @@ +# Copyright (c) 2006-2012 Filip Wasilewski +# Copyright (c) 2012-2016 The PyWavelets Developers +# +# See COPYING for license details. + +""" +Other wavelet related functions. +""" + +from __future__ import division, print_function, absolute_import + +import warnings + +import numpy as np +from numpy.fft import fft + +from ._extensions._pywt import DiscreteContinuousWavelet, Wavelet, ContinuousWavelet + + +__all__ = ["integrate_wavelet", "central_frequency", "scale2frequency", "qmf", + "orthogonal_filter_bank", + "intwave", "centrfrq", "scal2frq", "orthfilt"] + + +_DEPRECATION_MSG = ("`{old}` has been renamed to `{new}` and will " + "be removed in a future version of pywt.") + + +def _integrate(arr, step): + integral = np.cumsum(arr) + integral *= step + return integral + + +def intwave(*args, **kwargs): + msg = _DEPRECATION_MSG.format(old='intwave', new='integrate_wavelet') + warnings.warn(msg, DeprecationWarning) + return integrate_wavelet(*args, **kwargs) + + +def centrfrq(*args, **kwargs): + msg = _DEPRECATION_MSG.format(old='centrfrq', new='central_frequency') + warnings.warn(msg, DeprecationWarning) + return central_frequency(*args, **kwargs) + + +def scal2frq(*args, **kwargs): + msg = _DEPRECATION_MSG.format(old='scal2frq', new='scale2frequency') + warnings.warn(msg, DeprecationWarning) + return scale2frequency(*args, **kwargs) + + +def orthfilt(*args, **kwargs): + msg = _DEPRECATION_MSG.format(old='orthfilt', new='orthogonal_filter_bank') + warnings.warn(msg, DeprecationWarning) + return orthogonal_filter_bank(*args, **kwargs) + + +def integrate_wavelet(wavelet, precision=8): + """ + Integrate `psi` wavelet function from -Inf to x using the rectangle + integration method. + + Parameters + ---------- + wavelet : Wavelet instance or str + Wavelet to integrate. If a string, should be the name of a wavelet. + precision : int, optional + Precision that will be used for wavelet function + approximation computed with the wavefun(level=precision) + Wavelet's method (default: 8). + + Returns + ------- + [int_psi, x] : + for orthogonal wavelets + [int_psi_d, int_psi_r, x] : + for other wavelets + + + Examples + -------- + >>> from pywt import Wavelet, integrate_wavelet + >>> wavelet1 = Wavelet('db2') + >>> [int_psi, x] = integrate_wavelet(wavelet1, precision=5) + >>> wavelet2 = Wavelet('bior1.3') + >>> [int_psi_d, int_psi_r, x] = integrate_wavelet(wavelet2, precision=5) + + """ + # FIXME: this function should really use scipy.integrate.quad + + if type(wavelet) in (tuple, list): + msg = ("Integration of a general signal is deprecated " + "and will be removed in a future version of pywt.") + warnings.warn(msg, DeprecationWarning) + elif not isinstance(wavelet, (Wavelet, ContinuousWavelet)): + wavelet = DiscreteContinuousWavelet(wavelet) + + if type(wavelet) in (tuple, list): + psi, x = np.asarray(wavelet[0]), np.asarray(wavelet[1]) + step = x[1] - x[0] + return _integrate(psi, step), x + + functions_approximations = wavelet.wavefun(precision) + + if len(functions_approximations) == 2: # continuous wavelet + psi, x = functions_approximations + step = x[1] - x[0] + return _integrate(psi, step), x + + elif len(functions_approximations) == 3: # orthogonal wavelet + phi, psi, x = functions_approximations + step = x[1] - x[0] + return _integrate(psi, step), x + + else: # biorthogonal wavelet + phi_d, psi_d, phi_r, psi_r, x = functions_approximations + step = x[1] - x[0] + return _integrate(psi_d, step), _integrate(psi_r, step), x + + +def central_frequency(wavelet, precision=8): + """ + Computes the central frequency of the `psi` wavelet function. + + Parameters + ---------- + wavelet : Wavelet instance, str or tuple + Wavelet to integrate. If a string, should be the name of a wavelet. + precision : int, optional + Precision that will be used for wavelet function + approximation computed with the wavefun(level=precision) + Wavelet's method (default: 8). + + Returns + ------- + scalar + + """ + + if not isinstance(wavelet, (Wavelet, ContinuousWavelet)): + wavelet = DiscreteContinuousWavelet(wavelet) + + functions_approximations = wavelet.wavefun(precision) + + if len(functions_approximations) == 2: + psi, x = functions_approximations + else: + # (psi, x) for (phi, psi, x) + # (psi_d, x) for (phi_d, psi_d, phi_r, psi_r, x) + psi, x = functions_approximations[1], functions_approximations[-1] + + domain = float(x[-1] - x[0]) + assert domain > 0 + + index = np.argmax(abs(fft(psi)[1:])) + 2 + if index > len(psi) / 2: + index = len(psi) - index + 2 + + return 1.0 / (domain / (index - 1)) + + +def scale2frequency(wavelet, scale, precision=8): + """ + + Parameters + ---------- + wavelet : Wavelet instance or str + Wavelet to integrate. If a string, should be the name of a wavelet. + scale : scalar + precision : int, optional + Precision that will be used for wavelet function approximation computed + with ``wavelet.wavefun(level=precision)``. Default is 8. + + Returns + ------- + freq : scalar + + """ + return central_frequency(wavelet, precision=precision) / scale + + +def qmf(filt): + """ + Returns the Quadrature Mirror Filter(QMF). + + The magnitude response of QMF is mirror image about `pi/2` of that of the + input filter. + + Parameters + ---------- + filt : array_like + Input filter for which QMF needs to be computed. + + Returns + ------- + qm_filter : ndarray + Quadrature mirror of the input filter. + + """ + qm_filter = np.array(filt)[::-1] + qm_filter[1::2] = -qm_filter[1::2] + return qm_filter + + +def orthogonal_filter_bank(scaling_filter): + """ + Returns the orthogonal filter bank. + + The orthogonal filter bank consists of the HPFs and LPFs at + decomposition and reconstruction stage for the input scaling filter. + + Parameters + ---------- + scaling_filter : array_like + Input scaling filter (father wavelet). + + Returns + ------- + orth_filt_bank : tuple of 4 ndarrays + The orthogonal filter bank of the input scaling filter in the order : + 1] Decomposition LPF + 2] Decomposition HPF + 3] Reconstruction LPF + 4] Reconstruction HPF + + """ + if not (len(scaling_filter) % 2 == 0): + raise ValueError("`scaling_filter` length has to be even.") + + scaling_filter = np.asarray(scaling_filter, dtype=np.float64) + + rec_lo = np.sqrt(2) * scaling_filter / np.sum(scaling_filter) + dec_lo = rec_lo[::-1] + + rec_hi = qmf(rec_lo) + dec_hi = rec_hi[::-1] + + orth_filt_bank = (dec_lo, dec_hi, rec_lo, rec_hi) + return orth_filt_bank diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_mra.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_mra.py new file mode 100644 index 0000000000000000000000000000000000000000..cf0c9eb895cad1d43766902b95b66480139b6d1f --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_mra.py @@ -0,0 +1,427 @@ +from functools import partial, reduce + +import numpy as np + +from ._multilevel import (_prep_axes_wavedecn, wavedec, wavedec2, wavedecn, + waverec, waverec2, waverecn) +from ._swt import iswt, iswt2, iswtn, swt, swt2, swt_max_level, swtn +from ._utils import _modes_per_axis, _wavelets_per_axis + +__all__ = ["mra", "mra2", "mran", "imra", "imra2", "imran"] + + +def mra(data, wavelet, level=None, axis=-1, transform='swt', + mode='periodization'): + """Forward 1D multiresolution analysis. + + It is a projection onto the wavelet subspaces. + + Parameters + ---------- + data: array_like + Input data + wavelet : Wavelet object or name string + Wavelet to use + level : int, optional + Decomposition level (must be >= 0). If level is None (default) then it + will be calculated using the `dwt_max_level` function. + axis: int, optional + Axis over which to compute the DWT. If not given, the last axis is + used. Currently only available when ``transform='dwt'``. + transform : {'dwt', 'swt'} + Whether to use the DWT or SWT for the transforms. + mode : str, optional + Signal extension mode, see `Modes` (default: 'symmetric'). This option + is only used when transform='dwt'. + + Returns + ------- + [cAn, {details_level_n}, ... {details_level_1}] : list + For more information, see the detailed description in `wavedec` + + See Also + -------- + imra, swt + + Notes + ----- + This is sometimes referred to as an additive decomposition because the + inverse transform (``imra``) is just the sum of the coefficient arrays + [1]_. The decomposition using ``transform='dwt'`` corresponds to section + 2.2 while that using an undecimated transform (``transform='swt'``) is + described in section 3.2 and appendix A. + + This transform does not share the variance partition property of ``swt`` + with `norm=True`. It does however, result in coefficients that are + temporally aligned regardless of the symmetry of the wavelet used. + + The redundancy of this transform is ``(level + 1)``. + + References + ---------- + .. [1] Donald B. Percival and Harold O. Mofjeld. Analysis of Subtidal + Coastal Sea Level Fluctuations Using Wavelets. Journal of the American + Statistical Association Vol. 92, No. 439 (Sep., 1997), pp. 868-880. + https://doi.org/10.2307/2965551 + + """ + if transform == 'swt': + if mode != 'periodization': + raise ValueError( + "transform swt only supports mode='periodization'") + kwargs = dict(wavelet=wavelet, axis=axis, norm=True) + forward = partial(swt, level=level, trim_approx=True, **kwargs) + inverse = partial(iswt, **kwargs) + is_swt = True + elif transform == 'dwt': + kwargs = dict(wavelet=wavelet, mode=mode, axis=axis) + forward = partial(wavedec, level=level, **kwargs) + inverse = partial(waverec, **kwargs) + is_swt = False + else: + raise ValueError("unrecognized transform: {}".format(transform)) + + wav_coeffs = forward(data) + + mra_coeffs = [] + nc = len(wav_coeffs) + + if is_swt: + # replicate same zeros array to save memory + z = np.zeros_like(wav_coeffs[0]) + tmp = [z, ] * nc + else: + # zero arrays have variable size in DWT case + tmp = [np.zeros_like(c) for c in wav_coeffs] + + for j in range(nc): + # tmp has arrays of zeros except for the jth entry + tmp[j] = wav_coeffs[j] + + # reconstruct + rec = inverse(tmp) + if rec.shape != data.shape: + # trim any excess coefficients + rec = rec[tuple([slice(sz) for sz in data.shape])] + mra_coeffs.append(rec) + + # restore zeros + if is_swt: + tmp[j] = z + else: + tmp[j] = np.zeros_like(tmp[j]) + return mra_coeffs + + +def imra(mra_coeffs): + """Inverse 1D multiresolution analysis via summation. + + Parameters + ---------- + mra_coeffs : list of ndarray + Multiresolution analysis coefficients as returned by `mra`. + + Returns + ------- + rec : ndarray + The reconstructed signal. + + See Also + -------- + mra + + References + ---------- + .. [1] Donald B. Percival and Harold O. Mofjeld. Analysis of Subtidal + Coastal Sea Level Fluctuations Using Wavelets. Journal of the American + Statistical Association Vol. 92, No. 439 (Sep., 1997), pp. 868-880. + https://doi.org/10.2307/2965551 + """ + return reduce(lambda x, y: x + y, mra_coeffs) + + +def mra2(data, wavelet, level=None, axes=(-2, -1), transform='swt2', + mode='periodization'): + """Forward 2D multiresolution analysis. + + It is a projection onto wavelet subspaces. + + Parameters + ---------- + data: array_like + Input data + wavelet : Wavelet object or name string, or 2-tuple of wavelets + Wavelet to use. This can also be a tuple containing a wavelet to + apply along each axis in `axes`. + level : int, optional + Decomposition level (must be >= 0). If level is None (default) then it + will be calculated using the `dwt_max_level` function. + axes : 2-tuple of ints, optional + Axes over which to compute the DWT. Repeated elements are not allowed. + Currently only available when ``transform='dwt2'``. + transform : {'dwt2', 'swt2'} + Whether to use the DWT or SWT for the transforms. + mode : str or 2-tuple of str, optional + Signal extension mode, see `Modes` (default: 'symmetric'). This option + is only used when transform='dwt2'. + + Returns + ------- + coeffs : list + For more information, see the detailed description in `wavedec2` + + Notes + ----- + This is sometimes referred to as an additive decomposition because the + inverse transform (``imra2``) is just the sum of the coefficient arrays + [1]_. The decomposition using ``transform='dwt'`` corresponds to section + 2.2 while that using an undecimated transform (``transform='swt'``) is + described in section 3.2 and appendix A. + + This transform does not share the variance partition property of ``swt2`` + with `norm=True`. It does however, result in coefficients that are + temporally aligned regardless of the symmetry of the wavelet used. + + The redundancy of this transform is ``3 * level + 1``. + + See Also + -------- + imra2, swt2 + + References + ---------- + .. [1] Donald B. Percival and Harold O. Mofjeld. Analysis of Subtidal + Coastal Sea Level Fluctuations Using Wavelets. Journal of the American + Statistical Association Vol. 92, No. 439 (Sep., 1997), pp. 868-880. + https://doi.org/10.2307/2965551 + """ + if transform == 'swt2': + if mode != 'periodization': + raise ValueError( + "transform swt only supports mode='periodization'") + if level is None: + level = min(swt_max_level(s) for s in data.shape) + kwargs = dict(wavelet=wavelet, axes=axes, norm=True) + forward = partial(swt2, level=level, trim_approx=True, **kwargs) + inverse = partial(iswt2, **kwargs) + elif transform == 'dwt2': + kwargs = dict(wavelet=wavelet, mode=mode, axes=axes) + forward = partial(wavedec2, level=level, **kwargs) + inverse = partial(waverec2, **kwargs) + else: + raise ValueError("unrecognized transform: {}".format(transform)) + + wav_coeffs = forward(data) + + mra_coeffs = [] + nc = len(wav_coeffs) + z = np.zeros_like(wav_coeffs[0]) + tmp = [z] + for j in range(1, nc): + tmp.append([np.zeros_like(c) for c in wav_coeffs[j]]) + + # tmp has arrays of zeros except for the jth entry + tmp[0] = wav_coeffs[0] + # reconstruct + rec = inverse(tmp) + if rec.shape != data.shape: + # trim any excess coefficients + rec = rec[tuple([slice(sz) for sz in data.shape])] + mra_coeffs.append(rec) + # restore zeros + tmp[0] = z + + for j in range(1, nc): + dcoeffs = [] + for n in range(3): + # tmp has arrays of zeros except for the jth entry + z = tmp[j][n] + tmp[j][n] = wav_coeffs[j][n] + # reconstruct + rec = inverse(tmp) + if rec.shape != data.shape: + # trim any excess coefficients + rec = rec[tuple([slice(sz) for sz in data.shape])] + dcoeffs.append(rec) + # restore zeros + tmp[j][n] = z + mra_coeffs.append(tuple(dcoeffs)) + return mra_coeffs + + +def imra2(mra_coeffs): + """Inverse 2D multiresolution analysis via summation. + + Parameters + ---------- + mra_coeffs : list + Multiresolution analysis coefficients as returned by `mra2`. + + Returns + ------- + rec : ndarray + The reconstructed signal. + + See Also + -------- + mra2 + + References + ---------- + .. [1] Donald B. Percival and Harold O. Mofjeld. Analysis of Subtidal + Coastal Sea Level Fluctuations Using Wavelets. Journal of the American + Statistical Association Vol. 92, No. 439 (Sep., 1997), pp. 868-880. + https://doi.org/10.2307/2965551 + """ + rec = mra_coeffs[0] + for j in range(1, len(mra_coeffs)): + for n in range(3): + rec += mra_coeffs[j][n] + return rec + + +def mran(data, wavelet, level=None, axes=None, transform='swtn', + mode='periodization'): + """Forward nD multiresolution analysis. + + It is a projection onto the wavelet subspaces. + + Parameters + ---------- + data: array_like + Input data + wavelet : Wavelet object or name string, or tuple of wavelets + Wavelet to use. This can also be a tuple containing a wavelet to + apply along each axis in `axes`. + level : int, optional + Decomposition level (must be >= 0). If level is None (default) then it + will be calculated using the `dwt_max_level` function. + axes : tuple of ints, optional + Axes over which to compute the DWT. Repeated elements are not allowed. + transform : {'dwtn', 'swtn'} + Whether to use the DWT or SWT for the transforms. + mode : str or tuple of str, optional + Signal extension mode, see `Modes` (default: 'symmetric'). This option + is only used when transform='dwtn'. + + Returns + ------- + coeffs : list + For more information, see the detailed description in `wavedecn`. + + See Also + -------- + imran, swtn + + Notes + ----- + This is sometimes referred to as an additive decomposition because the + inverse transform (``imran``) is just the sum of the coefficient arrays + [1]_. The decomposition using ``transform='dwt'`` corresponds to section + 2.2 while that using an undecimated transform (``transform='swt'``) is + described in section 3.2 and appendix A. + + This transform does not share the variance partition property of ``swtn`` + with `norm=True`. It does however, result in coefficients that are + temporally aligned regardless of the symmetry of the wavelet used. + + The redundancy of this transform is ``(2**n - 1) * level + 1`` where ``n`` + corresponds to the number of axes transformed. + + References + ---------- + .. [1] Donald B. Percival and Harold O. Mofjeld. Analysis of Subtidal + Coastal Sea Level Fluctuations Using Wavelets. Journal of the American + Statistical Association Vol. 92, No. 439 (Sep., 1997), pp. 868-880. + https://doi.org/10.2307/2965551 + """ + axes, axes_shapes, ndim_transform = _prep_axes_wavedecn(data.shape, axes) + wavelets = _wavelets_per_axis(wavelet, axes) + + if transform == 'swtn': + if mode != 'periodization': + raise ValueError( + "transform swt only supports mode='periodization'") + if level is None: + level = min(swt_max_level(s) for s in data.shape) + kwargs = dict(wavelet=wavelets, axes=axes, norm=True) + forward = partial(swtn, level=level, trim_approx=True, **kwargs) + inverse = partial(iswtn, **kwargs) + elif transform == 'dwtn': + modes = _modes_per_axis(mode, axes) + kwargs = dict(wavelet=wavelets, mode=modes, axes=axes) + forward = partial(wavedecn, level=level, **kwargs) + inverse = partial(waverecn, **kwargs) + else: + raise ValueError("unrecognized transform: {}".format(transform)) + + wav_coeffs = forward(data) + + mra_coeffs = [] + nc = len(wav_coeffs) + z = np.zeros_like(wav_coeffs[0]) + tmp = [z] + for j in range(1, nc): + tmp.append({k: np.zeros_like(v) for k, v in wav_coeffs[j].items()}) + + # tmp has arrays of zeros except for the jth entry + tmp[0] = wav_coeffs[0] + # reconstruct + rec = inverse(tmp) + if rec.shape != data.shape: + # trim any excess coefficients + rec = rec[tuple([slice(sz) for sz in data.shape])] + mra_coeffs.append(rec) + # restore zeros + tmp[0] = z + + for j in range(1, nc): + dcoeffs = {} + dkeys = list(wav_coeffs[j].keys()) + for k in dkeys: + # tmp has arrays of zeros except for the jth entry + z = tmp[j][k] + tmp[j][k] = wav_coeffs[j][k] + # tmp[j]['a' * len(k)] = z + # reconstruct + rec = inverse(tmp) + if rec.shape != data.shape: + # trim any excess coefficients + rec = rec[tuple([slice(sz) for sz in data.shape])] + dcoeffs[k] = rec + # restore zeros + tmp[j][k] = z + # tmp[j].pop('a' * len(k)) + mra_coeffs.append(dcoeffs) + return mra_coeffs + + +def imran(mra_coeffs): + """Inverse nD multiresolution analysis via summation. + + Parameters + ---------- + mra_coeffs : list + Multiresolution analysis coefficients as returned by `mra2`. + + Returns + ------- + rec : ndarray + The reconstructed signal. + + See Also + -------- + mran + + References + ---------- + .. [1] Donald B. Percival and Harold O. Mofjeld. Analysis of Subtidal + Coastal Sea Level Fluctuations Using Wavelets. Journal of the American + Statistical Association Vol. 92, No. 439 (Sep., 1997), pp. 868-880. + https://doi.org/10.2307/2965551 + """ + rec = mra_coeffs[0] + for j in range(1, len(mra_coeffs)): + for k, v in mra_coeffs[j].items(): + rec += v + return rec diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_multidim.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_multidim.py new file mode 100644 index 0000000000000000000000000000000000000000..23bd2e4972abdf257d20efc0c421d8f1a9e38c47 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_multidim.py @@ -0,0 +1,314 @@ +# Copyright (c) 2006-2012 Filip Wasilewski +# Copyright (c) 2012-2016 The PyWavelets Developers +# +# See COPYING for license details. + +""" +2D and nD Discrete Wavelet Transforms and Inverse Discrete Wavelet Transforms. +""" + +from __future__ import division, print_function, absolute_import + +from itertools import product + +import numpy as np + +from ._c99_config import _have_c99_complex +from ._extensions._dwt import dwt_axis, idwt_axis +from ._utils import _wavelets_per_axis, _modes_per_axis + + +__all__ = ['dwt2', 'idwt2', 'dwtn', 'idwtn'] + + +def dwt2(data, wavelet, mode='symmetric', axes=(-2, -1)): + """ + 2D Discrete Wavelet Transform. + + Parameters + ---------- + data : array_like + 2D array with input data + wavelet : Wavelet object or name string, or 2-tuple of wavelets + Wavelet to use. This can also be a tuple containing a wavelet to + apply along each axis in ``axes``. + mode : str or 2-tuple of strings, optional + Signal extension mode, see :ref:`Modes `. This can + also be a tuple of modes specifying the mode to use on each axis in + ``axes``. + axes : 2-tuple of ints, optional + Axes over which to compute the DWT. Repeated elements mean the DWT will + be performed multiple times along these axes. + + Returns + ------- + (cA, (cH, cV, cD)) : tuple + Approximation, horizontal detail, vertical detail and diagonal + detail coefficients respectively. Horizontal refers to array axis 0 + (or ``axes[0]`` for user-specified ``axes``). + + Examples + -------- + >>> import numpy as np + >>> import pywt + >>> data = np.ones((4,4), dtype=np.float64) + >>> coeffs = pywt.dwt2(data, 'haar') + >>> cA, (cH, cV, cD) = coeffs + >>> cA + array([[ 2., 2.], + [ 2., 2.]]) + >>> cV + array([[ 0., 0.], + [ 0., 0.]]) + + """ + axes = tuple(axes) + data = np.asarray(data) + if len(axes) != 2: + raise ValueError("Expected 2 axes") + if data.ndim < len(np.unique(axes)): + raise ValueError("Input array has fewer dimensions than the specified " + "axes") + + coefs = dwtn(data, wavelet, mode, axes) + return coefs['aa'], (coefs['da'], coefs['ad'], coefs['dd']) + + +def idwt2(coeffs, wavelet, mode='symmetric', axes=(-2, -1)): + """ + 2-D Inverse Discrete Wavelet Transform. + + Reconstructs data from coefficient arrays. + + Parameters + ---------- + coeffs : tuple + (cA, (cH, cV, cD)) A tuple with approximation coefficients and three + details coefficients 2D arrays like from ``dwt2``. If any of these + components are set to ``None``, it will be treated as zeros. + wavelet : Wavelet object or name string, or 2-tuple of wavelets + Wavelet to use. This can also be a tuple containing a wavelet to + apply along each axis in ``axes``. + mode : str or 2-tuple of strings, optional + Signal extension mode, see :ref:`Modes `. This can + also be a tuple of modes specifying the mode to use on each axis in + ``axes``. + axes : 2-tuple of ints, optional + Axes over which to compute the IDWT. Repeated elements mean the IDWT + will be performed multiple times along these axes. + + Examples + -------- + >>> import numpy as np + >>> import pywt + >>> data = np.array([[1,2], [3,4]], dtype=np.float64) + >>> coeffs = pywt.dwt2(data, 'haar') + >>> pywt.idwt2(coeffs, 'haar') + array([[ 1., 2.], + [ 3., 4.]]) + + """ + # L -low-pass data, H - high-pass data + LL, (HL, LH, HH) = coeffs + axes = tuple(axes) + if len(axes) != 2: + raise ValueError("Expected 2 axes") + + coeffs = {'aa': LL, 'da': HL, 'ad': LH, 'dd': HH} + return idwtn(coeffs, wavelet, mode, axes) + + +def dwtn(data, wavelet, mode='symmetric', axes=None): + """ + Single-level n-dimensional Discrete Wavelet Transform. + + Parameters + ---------- + data : array_like + n-dimensional array with input data. + wavelet : Wavelet object or name string, or tuple of wavelets + Wavelet to use. This can also be a tuple containing a wavelet to + apply along each axis in ``axes``. + mode : str or tuple of string, optional + Signal extension mode used in the decomposition, + see :ref:`Modes `. This can also be a tuple of modes + specifying the mode to use on each axis in ``axes``. + axes : sequence of ints, optional + Axes over which to compute the DWT. Repeated elements mean the DWT will + be performed multiple times along these axes. A value of ``None`` (the + default) selects all axes. + + Axes may be repeated, but information about the original size may be + lost if it is not divisible by ``2 ** nrepeats``. The reconstruction + will be larger, with additional values derived according to the + ``mode`` parameter. ``pywt.wavedecn`` should be used for multilevel + decomposition. + + Returns + ------- + coeffs : dict + Results are arranged in a dictionary, where key specifies + the transform type on each dimension and value is a n-dimensional + coefficients array. + + For example, for a 2D case the result will look something like this:: + + {'aa': # A(LL) - approx. on 1st dim, approx. on 2nd dim + 'ad': # V(LH) - approx. on 1st dim, det. on 2nd dim + 'da': # H(HL) - det. on 1st dim, approx. on 2nd dim + 'dd': # D(HH) - det. on 1st dim, det. on 2nd dim + } + + For user-specified ``axes``, the order of the characters in the + dictionary keys map to the specified ``axes``. + + """ + data = np.asarray(data) + if not _have_c99_complex and np.iscomplexobj(data): + real = dwtn(data.real, wavelet, mode, axes) + imag = dwtn(data.imag, wavelet, mode, axes) + return dict((k, real[k] + 1j * imag[k]) for k in real.keys()) + + if data.dtype == np.dtype('object'): + raise TypeError("Input must be a numeric array-like") + if data.ndim < 1: + raise ValueError("Input data must be at least 1D") + + if axes is None: + axes = range(data.ndim) + axes = [a + data.ndim if a < 0 else a for a in axes] + + modes = _modes_per_axis(mode, axes) + wavelets = _wavelets_per_axis(wavelet, axes) + + coeffs = [('', data)] + for axis, wav, mode in zip(axes, wavelets, modes): + new_coeffs = [] + for subband, x in coeffs: + cA, cD = dwt_axis(x, wav, mode, axis) + new_coeffs.extend([(subband + 'a', cA), + (subband + 'd', cD)]) + coeffs = new_coeffs + return dict(coeffs) + + +def _fix_coeffs(coeffs): + missing_keys = [k for k, v in coeffs.items() if v is None] + if missing_keys: + raise ValueError( + "The following detail coefficients were set to None:\n" + "{0}\n" + "For multilevel transforms, rather than setting\n" + "\tcoeffs[key] = None\n" + "use\n" + "\tcoeffs[key] = np.zeros_like(coeffs[key])\n".format( + missing_keys)) + + invalid_keys = [k for k, v in coeffs.items() if + not set(k) <= set('ad')] + if invalid_keys: + raise ValueError( + "The following invalid keys were found in the detail " + "coefficient dictionary: {}.".format(invalid_keys)) + + key_lengths = [len(k) for k in coeffs.keys()] + if len(np.unique(key_lengths)) > 1: + raise ValueError( + "All detail coefficient names must have equal length.") + + return dict((k, np.asarray(v)) for k, v in coeffs.items()) + + +def idwtn(coeffs, wavelet, mode='symmetric', axes=None): + """ + Single-level n-dimensional Inverse Discrete Wavelet Transform. + + Parameters + ---------- + coeffs: dict + Dictionary as in output of ``dwtn``. Missing or ``None`` items + will be treated as zeros. + wavelet : Wavelet object or name string, or tuple of wavelets + Wavelet to use. This can also be a tuple containing a wavelet to + apply along each axis in ``axes``. + mode : str or list of string, optional + Signal extension mode used in the decomposition, + see :ref:`Modes `. This can also be a tuple of modes + specifying the mode to use on each axis in ``axes``. + axes : sequence of ints, optional + Axes over which to compute the IDWT. Repeated elements mean the IDWT + will be performed multiple times along these axes. A value of ``None`` + (the default) selects all axes. + + For the most accurate reconstruction, the axes should be provided in + the same order as they were provided to ``dwtn``. + + Returns + ------- + data: ndarray + Original signal reconstructed from input data. + + """ + + # drop the keys corresponding to value = None + coeffs = dict((k, v) for k, v in coeffs.items() if v is not None) + + # drop the keys corresponding to value = None + coeffs = dict((k, v) for k, v in coeffs.items() if v is not None) + + # Raise error for invalid key combinations + coeffs = _fix_coeffs(coeffs) + + if (not _have_c99_complex and + any(np.iscomplexobj(v) for v in coeffs.values())): + real_coeffs = dict((k, v.real) for k, v in coeffs.items()) + imag_coeffs = dict((k, v.imag) for k, v in coeffs.items()) + return (idwtn(real_coeffs, wavelet, mode, axes) + + 1j * idwtn(imag_coeffs, wavelet, mode, axes)) + + # key length matches the number of axes transformed + ndim_transform = max(len(key) for key in coeffs.keys()) + + try: + coeff_shapes = (v.shape for k, v in coeffs.items() + if v is not None and len(k) == ndim_transform) + coeff_shape = next(coeff_shapes) + except StopIteration: + raise ValueError("`coeffs` must contain at least one non-null wavelet " + "band") + if any(s != coeff_shape for s in coeff_shapes): + raise ValueError("`coeffs` must all be of equal size (or None)") + + if axes is None: + axes = range(ndim_transform) + ndim = ndim_transform + else: + ndim = len(coeff_shape) + axes = [a + ndim if a < 0 else a for a in axes] + + modes = _modes_per_axis(mode, axes) + wavelets = _wavelets_per_axis(wavelet, axes) + for key_length, (axis, wav, mode) in reversed( + list(enumerate(zip(axes, wavelets, modes)))): + if axis < 0 or axis >= ndim: + raise np.AxisError("Axis greater than data dimensions") + + new_coeffs = {} + new_keys = [''.join(coef) for coef in product('ad', repeat=key_length)] + + for key in new_keys: + L = coeffs.get(key + 'a', None) + H = coeffs.get(key + 'd', None) + if L is not None and H is not None: + if L.dtype != H.dtype: + # upcast to a common dtype (float64 or complex128) + if L.dtype.kind == 'c' or H.dtype.kind == 'c': + dtype = np.complex128 + else: + dtype = np.float64 + L = np.asarray(L, dtype=dtype) + H = np.asarray(H, dtype=dtype) + new_coeffs[key] = idwt_axis(L, H, wav, mode, axis) + coeffs = new_coeffs + + return coeffs[''] diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_multilevel.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_multilevel.py new file mode 100644 index 0000000000000000000000000000000000000000..70a18bd176fd9042ae593f929958467509a96268 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_multilevel.py @@ -0,0 +1,1561 @@ +# Copyright (c) 2006-2012 Filip Wasilewski +# Copyright (c) 2012-2018 The PyWavelets Developers +# +# See COPYING for license details. + +""" +Multilevel 1D and 2D Discrete Wavelet Transform +and Inverse Discrete Wavelet Transform. +""" + +from __future__ import division, print_function, absolute_import + +import numbers +import warnings +from itertools import product +from copy import copy +import numpy as np + +from ._extensions._pywt import Wavelet, Modes +from ._extensions._dwt import dwt_max_level +from ._dwt import dwt, idwt, dwt_coeff_len +from ._multidim import dwt2, idwt2, dwtn, idwtn, _fix_coeffs +from ._utils import _as_wavelet, _wavelets_per_axis, _modes_per_axis + +__all__ = ['wavedec', 'waverec', 'wavedec2', 'waverec2', 'wavedecn', + 'waverecn', 'coeffs_to_array', 'array_to_coeffs', 'ravel_coeffs', + 'unravel_coeffs', 'dwtn_max_level', 'wavedecn_size', + 'wavedecn_shapes', 'fswavedecn', 'fswaverecn', 'FswavedecnResult'] + + +def _check_level(sizes, dec_lens, level): + if np.isscalar(sizes): + sizes = (sizes, ) + if np.isscalar(dec_lens): + dec_lens = (dec_lens, ) + max_level = np.min([dwt_max_level(s, d) for s, d in zip(sizes, dec_lens)]) + if level is None: + level = max_level + elif level < 0: + raise ValueError( + "Level value of %d is too low . Minimum level is 0." % level) + elif level > max_level: + warnings.warn( + ("Level value of {} is too high: all coefficients will experience " + "boundary effects.").format(level)) + return level + + +def wavedec(data, wavelet, mode='symmetric', level=None, axis=-1): + """ + Multilevel 1D Discrete Wavelet Transform of data. + + Parameters + ---------- + data: array_like + Input data + wavelet : Wavelet object or name string + Wavelet to use + mode : str, optional + Signal extension mode, see :ref:`Modes `. + level : int, optional + Decomposition level (must be >= 0). If level is None (default) then it + will be calculated using the ``dwt_max_level`` function. + axis: int, optional + Axis over which to compute the DWT. If not given, the + last axis is used. + + Returns + ------- + [cA_n, cD_n, cD_n-1, ..., cD2, cD1] : list + Ordered list of coefficients arrays + where ``n`` denotes the level of decomposition. The first element + (``cA_n``) of the result is approximation coefficients array and the + following elements (``cD_n`` - ``cD_1``) are details coefficients + arrays. + + Examples + -------- + >>> from pywt import wavedec + >>> coeffs = wavedec([1,2,3,4,5,6,7,8], 'db1', level=2) + >>> cA2, cD2, cD1 = coeffs + >>> cD1 + array([-0.70710678, -0.70710678, -0.70710678, -0.70710678]) + >>> cD2 + array([-2., -2.]) + >>> cA2 + array([ 5., 13.]) + + """ + data = np.asarray(data) + + wavelet = _as_wavelet(wavelet) + try: + axes_shape = data.shape[axis] + except IndexError: + raise np.AxisError("Axis greater than data dimensions") + level = _check_level(axes_shape, wavelet.dec_len, level) + + coeffs_list = [] + + a = data + for i in range(level): + a, d = dwt(a, wavelet, mode, axis) + coeffs_list.append(d) + + coeffs_list.append(a) + coeffs_list.reverse() + + return coeffs_list + + +def waverec(coeffs, wavelet, mode='symmetric', axis=-1): + """ + Multilevel 1D Inverse Discrete Wavelet Transform. + + Parameters + ---------- + coeffs : array_like + Coefficients list [cAn, cDn, cDn-1, ..., cD2, cD1] + wavelet : Wavelet object or name string + Wavelet to use + mode : str, optional + Signal extension mode, see :ref:`Modes `. + axis: int, optional + Axis over which to compute the inverse DWT. If not given, the + last axis is used. + + Notes + ----- + It may sometimes be desired to run ``waverec`` with some sets of + coefficients omitted. This can best be done by setting the corresponding + arrays to zero arrays of matching shape and dtype. Explicitly removing + list entries or setting them to None is not supported. + + Specifically, to ignore detail coefficients at level 2, one could do:: + + coeffs[-2] == np.zeros_like(coeffs[-2]) + + Examples + -------- + >>> import pywt + >>> coeffs = pywt.wavedec([1,2,3,4,5,6,7,8], 'db1', level=2) + >>> pywt.waverec(coeffs, 'db1') + array([ 1., 2., 3., 4., 5., 6., 7., 8.]) + """ + + if not isinstance(coeffs, (list, tuple)): + raise ValueError("Expected sequence of coefficient arrays.") + + if len(coeffs) < 1: + raise ValueError( + "Coefficient list too short (minimum 1 arrays required).") + elif len(coeffs) == 1: + # level 0 transform (just returns the approximation coefficients) + return coeffs[0] + + a, ds = coeffs[0], coeffs[1:] + + for d in ds: + if d is not None and not isinstance(d, np.ndarray): + raise ValueError(( + "Unexpected detail coefficient type: {}. Detail coefficients " + "must be arrays as returned by wavedec. If you are using " + "pywt.array_to_coeffs or pywt.unravel_coeffs, please specify " + "output_format='wavedec'").format(type(d))) + if (a is not None) and (d is not None): + try: + if a.shape[axis] == d.shape[axis] + 1: + a = a[tuple(slice(s) for s in d.shape)] + elif a.shape[axis] != d.shape[axis]: + raise ValueError("coefficient shape mismatch") + except IndexError: + raise np.AxisError("Axis greater than coefficient dimensions") + a = idwt(a, d, wavelet, mode, axis) + + return a + + +def wavedec2(data, wavelet, mode='symmetric', level=None, axes=(-2, -1)): + """ + Multilevel 2D Discrete Wavelet Transform. + + Parameters + ---------- + data : ndarray + 2D input data + wavelet : Wavelet object or name string, or 2-tuple of wavelets + Wavelet to use. This can also be a tuple containing a wavelet to + apply along each axis in ``axes``. + mode : str or 2-tuple of str, optional + Signal extension mode, see :ref:`Modes `. This can + also be a tuple containing a mode to apply along each axis in ``axes``. + level : int, optional + Decomposition level (must be >= 0). If level is None (default) then it + will be calculated using the ``dwt_max_level`` function. + axes : 2-tuple of ints, optional + Axes over which to compute the DWT. Repeated elements are not allowed. + + Returns + ------- + [cAn, (cHn, cVn, cDn), ... (cH1, cV1, cD1)] : list + Coefficients list. For user-specified ``axes``, ``cH*`` + corresponds to ``axes[0]`` while ``cV*`` corresponds to ``axes[1]``. + The first element returned is the approximation coefficients for the + nth level of decomposition. Remaining elements are tuples of detail + coefficients in descending order of decomposition level. + (i.e. ``cH1`` are the horizontal detail coefficients at the first + level) + + Examples + -------- + >>> import pywt + >>> import numpy as np + >>> coeffs = pywt.wavedec2(np.ones((4,4)), 'db1') + >>> # Levels: + >>> len(coeffs)-1 + 2 + >>> pywt.waverec2(coeffs, 'db1') + array([[ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.]]) + """ + data = np.asarray(data) + if data.ndim < 2: + raise ValueError("Expected input data to have at least 2 dimensions.") + + axes = tuple(axes) + if len(axes) != 2: + raise ValueError("Expected 2 axes") + if len(axes) != len(set(axes)): + raise ValueError("The axes passed to wavedec2 must be unique.") + try: + axes_sizes = [data.shape[ax] for ax in axes] + except IndexError: + raise np.AxisError("Axis greater than data dimensions") + + wavelets = _wavelets_per_axis(wavelet, axes) + dec_lengths = [w.dec_len for w in wavelets] + + level = _check_level(axes_sizes, dec_lengths, level) + + coeffs_list = [] + + a = data + for i in range(level): + a, ds = dwt2(a, wavelet, mode, axes) + coeffs_list.append(ds) + + coeffs_list.append(a) + coeffs_list.reverse() + + return coeffs_list + + +def waverec2(coeffs, wavelet, mode='symmetric', axes=(-2, -1)): + """ + Multilevel 2D Inverse Discrete Wavelet Transform. + + coeffs : list or tuple + Coefficients list [cAn, (cHn, cVn, cDn), ... (cH1, cV1, cD1)] + wavelet : Wavelet object or name string, or 2-tuple of wavelets + Wavelet to use. This can also be a tuple containing a wavelet to + apply along each axis in ``axes``. + mode : str or 2-tuple of str, optional + Signal extension mode, see :ref:`Modes `. This can + also be a tuple containing a mode to apply along each axis in ``axes``. + axes : 2-tuple of ints, optional + Axes over which to compute the IDWT. Repeated elements are not allowed. + + Returns + ------- + 2D array of reconstructed data. + + Notes + ----- + It may sometimes be desired to run ``waverec2`` with some sets of + coefficients omitted. This can best be done by setting the corresponding + arrays to zero arrays of matching shape and dtype. Explicitly removing + list or tuple entries or setting them to None is not supported. + + Specifically, to ignore all detail coefficients at level 2, one could do:: + + coeffs[-2] == tuple([np.zeros_like(v) for v in coeffs[-2]]) + + Examples + -------- + >>> import pywt + >>> import numpy as np + >>> coeffs = pywt.wavedec2(np.ones((4,4)), 'db1') + >>> # Levels: + >>> len(coeffs)-1 + 2 + >>> pywt.waverec2(coeffs, 'db1') + array([[ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.]]) + """ + if not isinstance(coeffs, (list, tuple)): + raise ValueError("Expected sequence of coefficient arrays.") + + if len(axes) != len(set(axes)): + raise ValueError("The axes passed to waverec2 must be unique.") + + if len(coeffs) < 1: + raise ValueError( + "Coefficient list too short (minimum 1 array required).") + elif len(coeffs) == 1: + # level 0 transform (just returns the approximation coefficients) + return coeffs[0] + + a, ds = coeffs[0], coeffs[1:] + a = np.asarray(a) + + for d in ds: + if not isinstance(d, (list, tuple)) or len(d) != 3: + raise ValueError(( + "Unexpected detail coefficient type: {}. Detail coefficients " + "must be a 3-tuple of arrays as returned by wavedec2. If you " + "are using pywt.array_to_coeffs or pywt.unravel_coeffs, " + "please specify output_format='wavedec2'").format(type(d))) + d = tuple(np.asarray(coeff) if coeff is not None else None + for coeff in d) + d_shapes = (coeff.shape for coeff in d if coeff is not None) + try: + d_shape = next(d_shapes) + except StopIteration: + idxs = slice(None), slice(None) + else: + if not all(s == d_shape for s in d_shapes): + raise ValueError("All detail shapes must be the same length.") + idxs = tuple(slice(None, -1 if a_len == d_len + 1 else None) + for a_len, d_len in zip(a.shape, d_shape)) + a = idwt2((a[idxs], d), wavelet, mode, axes) + + return a + + +def _prep_axes_wavedecn(shape, axes): + if len(shape) < 1: + raise ValueError("Expected at least 1D input data.") + ndim = len(shape) + if np.isscalar(axes): + axes = (axes, ) + if axes is None: + axes = range(ndim) + else: + axes = tuple(axes) + if len(axes) != len(set(axes)): + raise ValueError("The axes passed to wavedecn must be unique.") + try: + axes_shapes = [shape[ax] for ax in axes] + except IndexError: + raise np.AxisError("Axis greater than data dimensions") + ndim_transform = len(axes) + return axes, axes_shapes, ndim_transform + + +def wavedecn(data, wavelet, mode='symmetric', level=None, axes=None): + """ + Multilevel nD Discrete Wavelet Transform. + + Parameters + ---------- + data : ndarray + nD input data + wavelet : Wavelet object or name string, or tuple of wavelets + Wavelet to use. This can also be a tuple containing a wavelet to + apply along each axis in ``axes``. + mode : str or tuple of str, optional + Signal extension mode, see :ref:`Modes `. This can + also be a tuple containing a mode to apply along each axis in ``axes``. + level : int, optional + Decomposition level (must be >= 0). If level is None (default) then it + will be calculated using the ``dwt_max_level`` function. + axes : sequence of ints, optional + Axes over which to compute the DWT. Axes may not be repeated. The + default is None, which means transform all axes + (``axes = range(data.ndim)``). + + Returns + ------- + [cAn, {details_level_n}, ... {details_level_1}] : list + Coefficients list. Coefficients are listed in descending order of + decomposition level. ``cAn`` are the approximation coefficients at + level ``n``. Each ``details_level_i`` element is a dictionary + containing detail coefficients at level ``i`` of the decomposition. As + a concrete example, a 3D decomposition would have the following set of + keys in each ``details_level_i`` dictionary:: + + {'aad', 'ada', 'daa', 'add', 'dad', 'dda', 'ddd'} + + where the order of the characters in each key map to the specified + ``axes``. + + Examples + -------- + >>> import numpy as np + >>> from pywt import wavedecn, waverecn + >>> coeffs = wavedecn(np.ones((4, 4, 4)), 'db1') + >>> # Levels: + >>> len(coeffs)-1 + 2 + >>> waverecn(coeffs, 'db1') # doctest: +NORMALIZE_WHITESPACE + array([[[ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.]], + [[ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.]], + [[ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.]], + [[ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.]]]) + + """ + data = np.asarray(data) + axes, axes_shapes, ndim_transform = _prep_axes_wavedecn(data.shape, axes) + wavelets = _wavelets_per_axis(wavelet, axes) + dec_lengths = [w.dec_len for w in wavelets] + + level = _check_level(axes_shapes, dec_lengths, level) + + coeffs_list = [] + + a = data + for i in range(level): + coeffs = dwtn(a, wavelet, mode, axes) + a = coeffs.pop('a' * ndim_transform) + coeffs_list.append(coeffs) + + coeffs_list.append(a) + coeffs_list.reverse() + + return coeffs_list + + +def _match_coeff_dims(a_coeff, d_coeff_dict): + # For each axis, compare the approximation coeff shape to one of the + # stored detail coeffs and truncate the last element along the axis + # if necessary. + if a_coeff is None: + return None + if not d_coeff_dict: + return a_coeff + d_coeff = d_coeff_dict[next(iter(d_coeff_dict))] + size_diffs = np.subtract(a_coeff.shape, d_coeff.shape) + if np.any((size_diffs < 0) | (size_diffs > 1)): + print(size_diffs) + raise ValueError("incompatible coefficient array sizes") + return a_coeff[tuple(slice(s) for s in d_coeff.shape)] + + +def waverecn(coeffs, wavelet, mode='symmetric', axes=None): + """ + Multilevel nD Inverse Discrete Wavelet Transform. + + coeffs : array_like + Coefficients list [cAn, {details_level_n}, ... {details_level_1}] + wavelet : Wavelet object or name string, or tuple of wavelets + Wavelet to use. This can also be a tuple containing a wavelet to + apply along each axis in ``axes``. + mode : str or tuple of str, optional + Signal extension mode, see :ref:`Modes `. This can + also be a tuple containing a mode to apply along each axis in ``axes``. + axes : sequence of ints, optional + Axes over which to compute the IDWT. Axes may not be repeated. + + Returns + ------- + nD array of reconstructed data. + + Notes + ----- + It may sometimes be desired to run ``waverecn`` with some sets of + coefficients omitted. This can best be done by setting the corresponding + arrays to zero arrays of matching shape and dtype. Explicitly removing + list or dictionary entries or setting them to None is not supported. + + Specifically, to ignore all detail coefficients at level 2, one could do:: + + coeffs[-2] = {k: np.zeros_like(v) for k, v in coeffs[-2].items()} + + Examples + -------- + >>> import numpy as np + >>> from pywt import wavedecn, waverecn + >>> coeffs = wavedecn(np.ones((4, 4, 4)), 'db1') + >>> # Levels: + >>> len(coeffs)-1 + 2 + >>> waverecn(coeffs, 'db1') # doctest: +NORMALIZE_WHITESPACE + array([[[ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.]], + [[ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.]], + [[ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.]], + [[ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.], + [ 1., 1., 1., 1.]]]) + + """ + if len(coeffs) < 1: + raise ValueError( + "Coefficient list too short (minimum 1 array required).") + + a, ds = coeffs[0], coeffs[1:] + + # this dictionary check must be prior to the call to _fix_coeffs + if len(ds) > 0 and not all([isinstance(d, dict) for d in ds]): + raise ValueError(( + "Unexpected detail coefficient type: {}. Detail coefficients " + "must be a dicionary of arrays as returned by wavedecn. If " + "you are using pywt.array_to_coeffs or pywt.unravel_coeffs, " + "please specify output_format='wavedecn'").format(type(ds[0]))) + + # Raise error for invalid key combinations + ds = list(map(_fix_coeffs, ds)) + + if not ds: + # level 0 transform (just returns the approximation coefficients) + return coeffs[0] + if a is None and not any(ds): + raise ValueError( + "At least one coefficient must contain a valid value.") + + coeff_ndims = [] + if a is not None: + a = np.asarray(a) + coeff_ndims.append(a.ndim) + for d in ds: + coeff_ndims += [v.ndim for k, v in d.items()] + + # test that all coefficients have a matching number of dimensions + unique_coeff_ndims = np.unique(coeff_ndims) + if len(unique_coeff_ndims) == 1: + ndim = unique_coeff_ndims[0] + else: + raise ValueError( + "All coefficients must have a matching number of dimensions") + + if np.isscalar(axes): + axes = (axes, ) + if axes is None: + axes = range(ndim) + else: + axes = tuple(axes) + if len(axes) != len(set(axes)): + raise ValueError("The axes passed to waverecn must be unique.") + ndim_transform = len(axes) + + for idx, d in enumerate(ds): + if a is None and not d: + continue + # The following if statement handles the case where the approximation + # coefficient returned at the previous level may exceed the size of the + # stored detail coefficients by 1 on any given axis. + if idx > 0: + a = _match_coeff_dims(a, d) + d['a' * ndim_transform] = a + a = idwtn(d, wavelet, mode, axes) + + return a + + +def _coeffs_wavedec_to_wavedecn(coeffs): + """Convert wavedec coefficients to the wavedecn format.""" + if len(coeffs) == 0: + return coeffs + coeffs = copy(coeffs) + for n in range(1, len(coeffs)): + if coeffs[n] is None: + continue + if coeffs[n].ndim != 1: + raise ValueError("expected a 1D coefficient array") + coeffs[n] = dict(d=coeffs[n]) + return coeffs + + +def _coeffs_wavedec2_to_wavedecn(coeffs): + """Convert wavedec2 coefficients to the wavedecn format.""" + if len(coeffs) == 0: + return coeffs + coeffs = copy(coeffs) + for n in range(1, len(coeffs)): + if not isinstance(coeffs[n], (tuple, list)) or len(coeffs[n]) != 3: + raise ValueError("expected a 3-tuple of detail coefficients") + (da, ad, dd) = coeffs[n] + if da is None or ad is None or dd is None: + raise ValueError( + "Expected numpy arrays of detail coefficients. Setting " + "coefficients to None is not supported.") + coeffs[n] = dict(ad=ad, da=da, dd=dd) + return coeffs + + +def _determine_coeff_array_shape(coeffs, axes): + arr_shape = np.asarray(coeffs[0].shape) + axes = np.asarray(axes) # axes that were transformed + ndim_transform = len(axes) + ncoeffs = coeffs[0].size + for d in coeffs[1:]: + arr_shape[axes] += np.asarray(d['d'*ndim_transform].shape)[axes] + for k, v in d.items(): + ncoeffs += v.size + arr_shape = tuple(arr_shape.tolist()) + # if the total number of coefficients doesn't equal the size of the array + # then tight packing is not possible. + is_tight_packing = (np.prod(arr_shape) == ncoeffs) + return arr_shape, is_tight_packing + + +def _prepare_coeffs_axes(coeffs, axes): + """Helper function to check type of coeffs and axes. + + This code is used by both coeffs_to_array and ravel_coeffs. + """ + if not isinstance(coeffs, list) or len(coeffs) == 0: + raise ValueError("input must be a list of coefficients from wavedecn") + if coeffs[0] is None: + raise ValueError("coeffs_to_array does not support missing " + "coefficients.") + if not isinstance(coeffs[0], np.ndarray): + raise ValueError("first list element must be a numpy array") + ndim = coeffs[0].ndim + + if len(coeffs) > 1: + # convert wavedec or wavedec2 format coefficients to waverecn format + if isinstance(coeffs[1], dict): + pass + elif isinstance(coeffs[1], np.ndarray): + coeffs = _coeffs_wavedec_to_wavedecn(coeffs) + elif isinstance(coeffs[1], (tuple, list)): + coeffs = _coeffs_wavedec2_to_wavedecn(coeffs) + else: + raise ValueError("invalid coefficient list") + + if len(coeffs) == 1: + # no detail coefficients were found + return coeffs, axes, ndim, None + + # Determine the number of dimensions that were transformed via key length + ndim_transform = len(list(coeffs[1].keys())[0]) + if axes is None: + if ndim_transform < ndim: + raise ValueError( + "coeffs corresponds to a DWT performed over only a subset of " + "the axes. In this case, axes must be specified.") + axes = np.arange(ndim) + + if len(axes) != ndim_transform: + raise ValueError( + "The length of axes doesn't match the number of dimensions " + "transformed.") + + return coeffs, axes, ndim, ndim_transform + + +def coeffs_to_array(coeffs, padding=0, axes=None): + """ + Arrange a wavelet coefficient list from ``wavedecn`` into a single array. + + Parameters + ---------- + + coeffs : array-like + Dictionary of wavelet coefficients as returned by pywt.wavedecn + padding : float or None, optional + The value to use for the background if the coefficients cannot be + tightly packed. If None, raise an error if the coefficients cannot be + tightly packed. + axes : sequence of ints, optional + Axes over which the DWT that created ``coeffs`` was performed. The + default value of None corresponds to all axes. + + Returns + ------- + coeff_arr : array-like + Wavelet transform coefficient array. + coeff_slices : list + List of slices corresponding to each coefficient. As a 2D example, + ``coeff_arr[coeff_slices[1]['dd']]`` would extract the first level + detail coefficients from ``coeff_arr``. + + See Also + -------- + array_to_coeffs : the inverse of coeffs_to_array + + Notes + ----- + Assume a 2D coefficient dictionary, c, from a two-level transform. + + Then all 2D coefficients will be stacked into a single larger 2D array + as follows:: + + +---------------+---------------+-------------------------------+ + | | | | + | c[0] | c[1]['da'] | | + | | | | + +---------------+---------------+ c[2]['da'] | + | | | | + | c[1]['ad'] | c[1]['dd'] | | + | | | | + +---------------+---------------+ ------------------------------+ + | | | + | | | + | | | + | c[2]['ad'] | c[2]['dd'] | + | | | + | | | + | | | + +-------------------------------+-------------------------------+ + + If the transform was not performed with mode "periodization" or the signal + length was not a multiple of ``2**level``, coefficients at each subsequent + scale will not be exactly 1/2 the size of those at the previous level due + to additional coefficients retained to handle the boundary condition. In + these cases, the default setting of `padding=0` indicates to pad the + individual coefficient arrays with 0 as needed so that they can be stacked + into a single, contiguous array. + + Examples + -------- + >>> import pywt + >>> cam = pywt.data.camera() + >>> coeffs = pywt.wavedecn(cam, wavelet='db2', level=3) + >>> arr, coeff_slices = pywt.coeffs_to_array(coeffs) + + """ + + coeffs, axes, ndim, ndim_transform = _prepare_coeffs_axes(coeffs, axes) + + # initialize with the approximation coefficients. + a_coeffs = coeffs[0] + a_shape = a_coeffs.shape + + if len(coeffs) == 1: + # only a single approximation coefficient array was found + return a_coeffs, [tuple([slice(None)] * ndim)] + + # determine size of output and if tight packing is possible + arr_shape, is_tight_packing = _determine_coeff_array_shape(coeffs, axes) + + # preallocate output array + if padding is None: + if not is_tight_packing: + raise ValueError("array coefficients cannot be tightly packed") + coeff_arr = np.empty(arr_shape, dtype=a_coeffs.dtype) + else: + coeff_arr = np.full(arr_shape, padding, dtype=a_coeffs.dtype) + + a_slices = tuple([slice(s) for s in a_shape]) + coeff_arr[a_slices] = a_coeffs + + # initialize list of coefficient slices + coeff_slices = [] + coeff_slices.append(a_slices) + + # loop over the detail cofficients, adding them to coeff_arr + ds = coeffs[1:] + for coeff_dict in ds: + coeff_slices.append({}) # new dictionary for detail coefficients + if np.any([d is None for d in coeff_dict.values()]): + raise ValueError("coeffs_to_array does not support missing " + "coefficients.") + d_shape = coeff_dict['d' * ndim_transform].shape + for key in coeff_dict.keys(): + d = coeff_dict[key] + slice_array = [slice(None), ] * ndim + for i, let in enumerate(key): + ax_i = axes[i] # axis corresponding to this transform index + if let == 'a': + slice_array[ax_i] = slice(d.shape[ax_i]) + elif let == 'd': + slice_array[ax_i] = slice(a_shape[ax_i], + a_shape[ax_i] + d.shape[ax_i]) + else: + raise ValueError("unexpected letter: {}".format(let)) + slice_array = tuple(slice_array) + coeff_arr[slice_array] = d + coeff_slices[-1][key] = slice_array + a_shape = [a_shape[n] + d_shape[n] for n in range(ndim)] + return coeff_arr, coeff_slices + + +def array_to_coeffs(arr, coeff_slices, output_format='wavedecn'): + """ + Convert a combined array of coefficients back to a list compatible with + ``waverecn``. + + Parameters + ---------- + + arr : array-like + An array containing all wavelet coefficients. This should have been + generated via ``coeffs_to_array``. + coeff_slices : list of tuples + List of slices corresponding to each coefficient as obtained from + ``array_to_coeffs``. + output_format : {'wavedec', 'wavedec2', 'wavedecn'} + Make the form of the coefficients compatible with this type of + multilevel transform. + + Returns + ------- + coeffs: array-like + Wavelet transform coefficient array. + + See Also + -------- + coeffs_to_array : the inverse of array_to_coeffs + + Notes + ----- + A single large array containing all coefficients will have subsets stored, + into a ``waverecn`` list, c, as indicated below:: + + +---------------+---------------+-------------------------------+ + | | | | + | c[0] | c[1]['da'] | | + | | | | + +---------------+---------------+ c[2]['da'] | + | | | | + | c[1]['ad'] | c[1]['dd'] | | + | | | | + +---------------+---------------+ ------------------------------+ + | | | + | | | + | | | + | c[2]['ad'] | c[2]['dd'] | + | | | + | | | + | | | + +-------------------------------+-------------------------------+ + + Examples + -------- + >>> import pywt + >>> from numpy.testing import assert_array_almost_equal + >>> cam = pywt.data.camera() + >>> coeffs = pywt.wavedecn(cam, wavelet='db2', level=3) + >>> arr, coeff_slices = pywt.coeffs_to_array(coeffs) + >>> coeffs_from_arr = pywt.array_to_coeffs(arr, coeff_slices, + ... output_format='wavedecn') + >>> cam_recon = pywt.waverecn(coeffs_from_arr, wavelet='db2') + >>> assert_array_almost_equal(cam, cam_recon) + + """ + arr = np.asarray(arr) + coeffs = [] + if len(coeff_slices) == 0: + raise ValueError("empty list of coefficient slices") + else: + coeffs.append(arr[coeff_slices[0]]) + + # difference coefficients at each level + for n in range(1, len(coeff_slices)): + if output_format == 'wavedec': + d = arr[coeff_slices[n]['d']] + elif output_format == 'wavedec2': + d = (arr[coeff_slices[n]['da']], + arr[coeff_slices[n]['ad']], + arr[coeff_slices[n]['dd']]) + elif output_format == 'wavedecn': + d = {} + for k, v in coeff_slices[n].items(): + d[k] = arr[v] + else: + raise ValueError( + "Unrecognized output format: {}".format(output_format)) + coeffs.append(d) + return coeffs + + +def wavedecn_shapes(shape, wavelet, mode='symmetric', level=None, axes=None): + """Subband shapes for a multilevel nD discrete wavelet transform. + + Parameters + ---------- + shape : sequence of ints + The shape of the data to be transformed. + wavelet : Wavelet object or name string, or tuple of wavelets + Wavelet to use. This can also be a tuple containing a wavelet to + apply along each axis in ``axes``. + mode : str or tuple of str, optional + Signal extension mode, see :ref:`Modes `. This can + also be a tuple containing a mode to apply along each axis in ``axes``. + level : int, optional + Decomposition level (must be >= 0). If level is None (default) then it + will be calculated using the ``dwt_max_level`` function. + axes : sequence of ints, optional + Axes over which to compute the DWT. Axes may not be repeated. The + default is None, which means transform all axes + (``axes = range(data.ndim)``). + + Returns + ------- + shapes : [cAn, {details_level_n}, ... {details_level_1}] : list + Coefficients shape list. Mirrors the output of ``wavedecn``, except + it contains only the shapes of the coefficient arrays rather than the + arrays themselves. + + Examples + -------- + >>> import pywt + >>> pywt.wavedecn_shapes((64, 32), wavelet='db2', level=3, axes=(0, )) + [(10, 32), {'d': (10, 32)}, {'d': (18, 32)}, {'d': (33, 32)}] + """ + axes, axes_shapes, ndim_transform = _prep_axes_wavedecn(shape, axes) + wavelets = _wavelets_per_axis(wavelet, axes) + modes = _modes_per_axis(mode, axes) + dec_lengths = [w.dec_len for w in wavelets] + + level = _check_level(min(axes_shapes), max(dec_lengths), level) + + shapes = [] + for i in range(level): + detail_keys = [''.join(c) for c in product('ad', repeat=len(axes))] + new_shapes = {k: list(shape) for k in detail_keys} + for axis, wav, mode in zip(axes, wavelets, modes): + s = dwt_coeff_len(shape[axis], filter_len=wav.dec_len, mode=mode) + for k in detail_keys: + new_shapes[k][axis] = s + for k, v in new_shapes.items(): + new_shapes[k] = tuple(v) + shapes.append(new_shapes) + shape = new_shapes.pop('a' * ndim_transform) + shapes.append(shape) + shapes.reverse() + return shapes + + +def wavedecn_size(shapes): + """Compute the total number of wavedecn coefficients. + + Parameters + ---------- + shapes : list of coefficient shapes + A set of coefficient shapes as returned by ``wavedecn_shapes``. + Alternatively, the user can specify a set of coefficients as returned + by ``wavedecn``. + + Returns + ------- + size : int + The total number of coefficients. + + Examples + -------- + >>> import numpy as np + >>> import pywt + >>> data_shape = (64, 32) + >>> shapes = pywt.wavedecn_shapes(data_shape, 'db2', mode='periodization') + >>> pywt.wavedecn_size(shapes) + 2048 + >>> coeffs = pywt.wavedecn(np.ones(data_shape), 'sym4', mode='symmetric') + >>> pywt.wavedecn_size(coeffs) + 3087 + """ + def _size(x): + """Size corresponding to ``x`` as either a shape tuple or ndarray.""" + if isinstance(x, np.ndarray): + return x.size + else: + return np.prod(x) + ncoeffs = _size(shapes[0]) + for d in shapes[1:]: + for k, v in d.items(): + if v is None: + raise ValueError( + "Setting coefficient arrays to None is not supported.") + ncoeffs += _size(v) + return ncoeffs + + +def dwtn_max_level(shape, wavelet, axes=None): + """Compute the maximum level of decomposition for n-dimensional data. + + This returns the maximum number of levels of decomposition suitable for use + with ``wavedec``, ``wavedec2`` or ``wavedecn``. + + Parameters + ---------- + shape : sequence of ints + Input data shape. + wavelet : Wavelet object or name string, or tuple of wavelets + Wavelet to use. This can also be a tuple containing a wavelet to + apply along each axis in ``axes``. + axes : sequence of ints, optional + Axes over which to compute the DWT. Axes may not be repeated. + + Returns + ------- + level : int + Maximum level. + + Notes + ----- + The level returned is the smallest ``dwt_max_level`` over all axes. + + Examples + -------- + >>> import pywt + >>> pywt.dwtn_max_level((64, 32), 'db2') + 3 + """ + # Determine the axes and shape for the transform + axes, axes_shapes, ndim_transform = _prep_axes_wavedecn(shape, axes) + + # initialize a Wavelet object per (transformed) axis + wavelets = _wavelets_per_axis(wavelet, axes) + + # maximum level of decomposition per axis + max_levels = [dwt_max_level(n, wav.dec_len) + for n, wav in zip(axes_shapes, wavelets)] + return min(max_levels) + + +def ravel_coeffs(coeffs, axes=None): + """Ravel a set of multilevel wavelet coefficients into a single 1D array. + + Parameters + ---------- + coeffs : array-like + A list of multilevel wavelet coefficients as returned by + ``wavedec``, ``wavedec2`` or ``wavedecn``. This function is also + compatible with the output of ``swt``, ``swt2`` and ``swtn`` if those + functions were called with ``trim_approx=True``. + axes : sequence of ints, optional + Axes over which the DWT that created ``coeffs`` was performed. The + default value of None corresponds to all axes. + + Returns + ------- + coeff_arr : array-like + Wavelet transform coefficient array. All coefficients have been + concatenated into a single array. + coeff_slices : list + List of slices corresponding to each coefficient. As a 2D example, + ``coeff_arr[coeff_slices[1]['dd']]`` would extract the first level + detail coefficients from ``coeff_arr``. + coeff_shapes : list + List of shapes corresponding to each coefficient. For example, in 2D, + ``coeff_shapes[1]['dd']`` would contain the original shape of the first + level detail coefficients array. + + See Also + -------- + unravel_coeffs : the inverse of ravel_coeffs + + Examples + -------- + >>> import pywt + >>> cam = pywt.data.camera() + >>> coeffs = pywt.wavedecn(cam, wavelet='db2', level=3) + >>> arr, coeff_slices, coeff_shapes = pywt.ravel_coeffs(coeffs) + + """ + coeffs, axes, ndim, ndim_transform = _prepare_coeffs_axes(coeffs, axes) + + # initialize with the approximation coefficients. + a_coeffs = coeffs[0] + a_size = a_coeffs.size + + if len(coeffs) == 1: + # only a single approximation coefficient array was found + return a_coeffs.ravel(), [slice(a_size), ], [a_coeffs.shape, ] + + # preallocate output array + arr_size = wavedecn_size(coeffs) + coeff_arr = np.empty((arr_size, ), dtype=a_coeffs.dtype) + + a_slice = slice(a_size) + coeff_arr[a_slice] = a_coeffs.ravel() + + # initialize list of coefficient slices + coeff_slices = [] + coeff_shapes = [] + coeff_slices.append(a_slice) + coeff_shapes.append(coeffs[0].shape) + + # loop over the detail cofficients, embedding them in coeff_arr + ds = coeffs[1:] + offset = a_size + for coeff_dict in ds: + # new dictionaries for detail coefficient slices and shapes + coeff_slices.append({}) + coeff_shapes.append({}) + if np.any([d is None for d in coeff_dict.values()]): + raise ValueError("coeffs_to_array does not support missing " + "coefficients.") + # sort to make sure key order is consistent across Python versions + keys = sorted(coeff_dict.keys()) + for key in keys: + d = coeff_dict[key] + sl = slice(offset, offset + d.size) + offset += d.size + coeff_arr[sl] = d.ravel() + coeff_slices[-1][key] = sl + coeff_shapes[-1][key] = d.shape + return coeff_arr, coeff_slices, coeff_shapes + + +def unravel_coeffs(arr, coeff_slices, coeff_shapes, output_format='wavedecn'): + """Unravel a raveled array of multilevel wavelet coefficients. + + Parameters + ---------- + arr : array-like + An array containing all wavelet coefficients. This should have been + generated by applying ``ravel_coeffs`` to the output of ``wavedec``, + ``wavedec2`` or ``wavedecn`` (or via ``swt``, ``swt2`` or ``swtn`` + with ``trim_approx=True``). + coeff_slices : list of tuples + List of slices corresponding to each coefficient as obtained from + ``ravel_coeffs``. + coeff_shapes : list of tuples + List of shapes corresponding to each coefficient as obtained from + ``ravel_coeffs``. + output_format : {'wavedec', 'wavedec2', 'wavedecn', 'swt', 'swt2', 'swtn'}, optional + Make the form of the unraveled coefficients compatible with this type + of multilevel transform. The default is ``'wavedecn'``. + + Returns + ------- + coeffs: list + List of wavelet transform coefficients. The specific format of the list + elements is determined by ``output_format``. + + See Also + -------- + ravel_coeffs : the inverse of unravel_coeffs + + Examples + -------- + >>> import pywt + >>> from numpy.testing import assert_array_almost_equal + >>> cam = pywt.data.camera() + >>> coeffs = pywt.wavedecn(cam, wavelet='db2', level=3) + >>> arr, coeff_slices, coeff_shapes = pywt.ravel_coeffs(coeffs) + >>> coeffs_from_arr = pywt.unravel_coeffs(arr, coeff_slices, coeff_shapes, + ... output_format='wavedecn') + >>> cam_recon = pywt.waverecn(coeffs_from_arr, wavelet='db2') + >>> assert_array_almost_equal(cam, cam_recon) + + """ + arr = np.asarray(arr) + coeffs = [] + if len(coeff_slices) == 0: + raise ValueError("empty list of coefficient slices") + elif len(coeff_shapes) == 0: + raise ValueError("empty list of coefficient shapes") + elif len(coeff_shapes) != len(coeff_slices): + raise ValueError("coeff_shapes and coeff_slices have unequal length") + else: + coeffs.append(arr[coeff_slices[0]].reshape(coeff_shapes[0])) + + # difference coefficients at each level + for n in range(1, len(coeff_slices)): + slice_dict = coeff_slices[n] + shape_dict = coeff_shapes[n] + if output_format in ['wavedec', 'swt']: + d = arr[slice_dict['d']].reshape(shape_dict['d']) + elif output_format in ['wavedec2', 'swt2']: + d = (arr[slice_dict['da']].reshape(shape_dict['da']), + arr[slice_dict['ad']].reshape(shape_dict['ad']), + arr[slice_dict['dd']].reshape(shape_dict['dd'])) + elif output_format in ['wavedecn', 'swtn']: + d = {} + for k, v in coeff_slices[n].items(): + d[k] = arr[v].reshape(shape_dict[k]) + else: + raise ValueError( + "Unrecognized output format: {}".format(output_format)) + coeffs.append(d) + return coeffs + + +def _check_fswavedecn_axes(data, axes): + """Axes checks common to fswavedecn, fswaverecn.""" + if len(axes) != len(set(axes)): + raise np.AxisError("The axes passed to fswavedecn must be unique.") + try: + [data.shape[ax] for ax in axes] + except IndexError: + raise np.AxisError("Axis greater than data dimensions") + + +class FswavedecnResult(object): + """Object representing fully separable wavelet transform coefficients. + + Parameters + ---------- + coeffs : ndarray + The coefficient array. + coeff_slices : list + List of slices corresponding to each detail or approximation + coefficient array. + wavelets : list of pywt.DiscreteWavelet objects + The wavelets used. Will be a list with length equal to + ``len(axes)``. + mode_enums : list of int + The border modes used. Will be a list with length equal to + ``len(axes)``. + axes : tuple of int + The set of axes over which the transform was performed. + + """ + def __init__(self, coeffs, coeff_slices, wavelets, mode_enums, + axes): + self._coeffs = coeffs + self._coeff_slices = coeff_slices + self._axes = axes + if not np.all(isinstance(w, Wavelet) for w in wavelets): + raise ValueError( + "wavelets must contain pywt.Wavelet objects") + self._wavelets = wavelets + if not np.all(isinstance(m, int) for m in mode_enums): + raise ValueError( + "mode_enums must be integers") + self._mode_enums = mode_enums + + @property + def coeffs(self): + """ndarray: All coefficients stacked into a single array.""" + return self._coeffs + + @coeffs.setter + def coeffs(self, c): + if c.shape != self._coeffs.shape: + raise ValueError("new coefficient array must match the existing " + "coefficient shape") + self._coeffs = c + + @property + def coeff_slices(self): + """List: List of coefficient slices.""" + return self._coeff_slices + + @property + def ndim(self): + """int: Number of data dimensions.""" + return self.coeffs.ndim + + @property + def ndim_transform(self): + """int: Number of axes transformed.""" + return len(self.axes) + + @property + def axes(self): + """List of str: The axes the transform was performed along.""" + return self._axes + + @property + def levels(self): + """List of int: Levels of decomposition along each transformed axis.""" + return [len(s) - 1 for s in self.coeff_slices] + + @property + def wavelets(self): + """List of pywt.DiscreteWavelet: wavelet for each transformed axis.""" + return self._wavelets + + @property + def wavelet_names(self): + """List of pywt.DiscreteWavelet: wavelet for each transformed axis.""" + return [w.name for w in self._wavelets] + + @property + def modes(self): + """List of str: The border mode used along each transformed axis.""" + names_dict = {getattr(Modes, mode): mode + for mode in Modes.modes} + return [names_dict[m] for m in self._mode_enums] + + def _get_coef_sl(self, levels): + sl = [slice(None), ] * self.ndim + for n, (ax, lev) in enumerate(zip(self.axes, levels)): + sl[ax] = self.coeff_slices[n][lev] + return tuple(sl) + + @property + def approx(self): + """ndarray: The approximation coefficients.""" + sl = self._get_coef_sl((0, )*self.ndim) + return self._coeffs[sl] + + @approx.setter + def approx(self, a): + sl = self._get_coef_sl((0, )*self.ndim) + if self._coeffs[sl].shape != a.shape: + raise ValueError( + "x does not match the shape of the requested coefficient") + self._coeffs[sl] = a + + def _validate_index(self, levels): + levels = tuple(levels) + + if len(levels) != len(self.axes): + raise ValueError( + "levels must match the number of transformed axes") + + # check that all elements are non-negative integers + if (not np.all([isinstance(lev, numbers.Number) for lev in levels]) or + np.any(np.asarray(levels) % 1 > 0) or + np.any([lev < 0 for lev in levels])): + raise ValueError("Index must be a tuple of non-negative integers") + # convert integer-valued floats to int + levels = tuple([int(lev) for lev in levels]) + + # check for out of range levels + if np.any([lev > maxlev for lev, maxlev in zip(levels, self.levels)]): + raise ValueError( + "Specified indices exceed the number of transform levels.") + + def __getitem__(self, levels): + """Retrieve a coefficient subband. + + Parameters + ---------- + levels : tuple of int + The number of degrees of decomposition along each transformed + axis. + """ + self._validate_index(levels) + sl = self._get_coef_sl(levels) + return self._coeffs[sl] + + def __setitem__(self, levels, x): + """Assign values to a coefficient subband. + + Parameters + ---------- + levels : tuple of int + The number of degrees of decomposition along each transformed + axis. + x : ndarray + The data corresponding to assign. It must match the expected + shape and dtype of the specified subband. + """ + self._validate_index(levels) + sl = self._get_coef_sl(levels) + current_dtype = self._coeffs[sl].dtype + if self._coeffs[sl].shape != x.shape: + raise ValueError( + "x does not match the shape of the requested coefficient") + if x.dtype != current_dtype: + warnings.warn("dtype mismatch: converting the provided array to" + "dtype {}".format(current_dtype)) + self._coeffs[sl] = x + + def detail_keys(self): + """Return a list of all detail coefficient keys. + + Returns + ------- + keys : list of str + List of all detail coefficient keys. + """ + keys = list(product(*(range(l+1) for l in self.levels))) + keys.remove((0, )*len(self.axes)) + return sorted(keys) + + +def fswavedecn(data, wavelet, mode='symmetric', levels=None, axes=None): + """Fully Separable Wavelet Decomposition. + + This is a variant of the multilevel discrete wavelet transform where all + levels of decomposition are performed along a single axis prior to moving + onto the next axis. Unlike in ``wavedecn``, the number of levels of + decomposition are not required to be the same along each axis which can be + a benefit for anisotropic data. + + Parameters + ---------- + data: array_like + Input data + wavelet : Wavelet object or name string, or tuple of wavelets + Wavelet to use. This can also be a tuple containing a wavelet to + apply along each axis in ``axes``. + mode : str or tuple of str, optional + Signal extension mode, see :ref:`Modes `. This can + also be a tuple containing a mode to apply along each axis in ``axes``. + levels : int or sequence of ints, optional + Decomposition levels along each axis (must be >= 0). If an integer is + provided, the same number of levels are used for all axes. If + ``levels`` is None (default), ``dwt_max_level`` will be used to compute + the maximum number of levels possible for each axis. + axes : sequence of ints, optional + Axes over which to compute the transform. Axes may not be repeated. The + default is to transform along all axes. + + Returns + ------- + fswavedecn_result : FswavedecnResult object + Contains the wavelet coefficients, slice objects to allow obtaining + the coefficients per detail or approximation level, and more. + See ``FswavedecnResult`` for details. + + Examples + -------- + >>> from pywt import fswavedecn + >>> fs_result = fswavedecn(np.ones((32, 32)), 'sym2', levels=(1, 3)) + >>> print(fs_result.detail_keys()) + [(0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3)] + >>> approx_coeffs = fs_result.approx + >>> detail_1_2 = fs_result[(1, 2)] + + + Notes + ----- + This transformation has been variously referred to as the (fully) separable + wavelet transform (e.g. refs [1]_, [3]_), the tensor-product wavelet + ([2]_) or the hyperbolic wavelet transform ([4]_). It is well suited to + data with anisotropic smoothness. + + In [2]_ it was demonstrated that fully separable transform performs at + least as well as the DWT for image compression. Computation time is a + factor 2 larger than that for the DWT. + + See Also + -------- + fswaverecn : inverse of fswavedecn + + References + ---------- + .. [1] PH Westerink. Subband Coding of Images. Ph.D. dissertation, Dept. + Elect. Eng., Inf. Theory Group, Delft Univ. Technol., Delft, The + Netherlands, 1989. (see Section 2.3) + http://resolver.tudelft.nl/uuid:a4d195c3-1f89-4d66-913d-db9af0969509 + + .. [2] CP Rosiene and TQ Nguyen. Tensor-product wavelet vs. Mallat + decomposition: A comparative analysis, in Proc. IEEE Int. Symp. + Circuits and Systems, Orlando, FL, Jun. 1999, pp. 431-434. + + .. [3] V Velisavljevic, B Beferull-Lozano, M Vetterli and PL Dragotti. + Directionlets: Anisotropic Multidirectional Representation With + Separable Filtering. IEEE Transactions on Image Processing, Vol. 15, + No. 7, July 2006. + + .. [4] RA DeVore, SV Konyagin and VN Temlyakov. "Hyperbolic wavelet + approximation," Constr. Approx. 14 (1998), 1-26. + """ + data = np.asarray(data) + if axes is None: + axes = tuple(np.arange(data.ndim)) + _check_fswavedecn_axes(data, axes) + + if levels is None or np.isscalar(levels): + levels = [levels, ] * len(axes) + if len(levels) != len(axes): + raise ValueError("levels must match the length of the axes list") + + modes = _modes_per_axis(mode, axes) + wavelets = _wavelets_per_axis(wavelet, axes) + + coeff_slices = [slice(None), ] * len(axes) + coeffs_arr = data + for ax_count, (ax, lev, wav, mode) in enumerate( + zip(axes, levels, wavelets, modes)): + coeffs = wavedec(coeffs_arr, wav, mode=mode, level=lev, axis=ax) + + # Slice objects for accessing coefficient subsets. + # These can be used to access specific detail coefficient arrays + # (e.g. as needed for inverse transformation via fswaverecn). + c_shapes = [c.shape[ax] for c in coeffs] + c_offsets = np.cumsum([0, ] + c_shapes) + coeff_slices[ax_count] = [ + slice(c_offsets[d], c_offsets[d+1]) for d in range(len(c_shapes))] + + # stack the coefficients from all levels into a single array + coeffs_arr = np.concatenate(coeffs, axis=ax) + + return FswavedecnResult(coeffs_arr, coeff_slices, wavelets, modes, axes) + + +def fswaverecn(fswavedecn_result): + """Fully Separable Inverse Wavelet Reconstruction. + + Parameters + ---------- + fswavedecn_result : FswavedecnResult object + FswavedecnResult object from ``fswavedecn``. + + Returns + ------- + reconstructed : ndarray + Array of reconstructed data. + + Notes + ----- + This transformation has been variously referred to as the (fully) separable + wavelet transform (e.g. refs [1]_, [3]_), the tensor-product wavelet + ([2]_) or the hyperbolic wavelet transform ([4]_). It is well suited to + data with anisotropic smoothness. + + In [2]_ it was demonstrated that the fully separable transform performs at + least as well as the DWT for image compression. Computation time is a + factor 2 larger than that for the DWT. + + See Also + -------- + fswavedecn : inverse of fswaverecn + + References + ---------- + .. [1] PH Westerink. Subband Coding of Images. Ph.D. dissertation, Dept. + Elect. Eng., Inf. Theory Group, Delft Univ. Technol., Delft, The + Netherlands, 1989. (see Section 2.3) + http://resolver.tudelft.nl/uuid:a4d195c3-1f89-4d66-913d-db9af0969509 + + .. [2] CP Rosiene and TQ Nguyen. Tensor-product wavelet vs. Mallat + decomposition: A comparative analysis, in Proc. IEEE Int. Symp. + Circuits and Systems, Orlando, FL, Jun. 1999, pp. 431-434. + + .. [3] V Velisavljevic, B Beferull-Lozano, M Vetterli and PL Dragotti. + Directionlets: Anisotropic Multidirectional Representation With + Separable Filtering. IEEE Transactions on Image Processing, Vol. 15, + No. 7, July 2006. + + .. [4] RA DeVore, SV Konyagin and VN Temlyakov. "Hyperbolic wavelet + approximation," Constr. Approx. 14 (1998), 1-26. + """ + coeffs_arr = fswavedecn_result.coeffs + coeff_slices = fswavedecn_result.coeff_slices + axes = fswavedecn_result.axes + modes = fswavedecn_result.modes + wavelets = fswavedecn_result.wavelets + + _check_fswavedecn_axes(coeffs_arr, axes) + if len(axes) != len(coeff_slices): + raise ValueError("dimension mismatch") + + arr = coeffs_arr + csl = [slice(None), ] * arr.ndim + # for ax_count, (ax, wav, mode) in reversed( + # list(enumerate(zip(axes, wavelets, modes)))): + for ax_count, (ax, wav, mode) in enumerate(zip(axes, wavelets, modes)): + coeffs = [] + for sl in coeff_slices[ax_count]: + csl[ax] = sl + coeffs.append(arr[tuple(csl)]) + csl[ax] = slice(None) + arr = waverec(coeffs, wav, mode=mode, axis=ax) + return arr diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_pytest.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_pytest.py new file mode 100644 index 0000000000000000000000000000000000000000..cfc9f0590b4e9438fa57396075d95bcf6fc4bf41 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_pytest.py @@ -0,0 +1,68 @@ +"""common test-related code.""" +import os +import sys +import multiprocessing +import numpy as np +import pytest + + +__all__ = ['uses_matlab', # skip if pymatbridge and Matlab unavailable + 'uses_futures', # skip if futures unavailable + 'uses_pymatbridge', # skip if no PYWT_XSLOW environment variable + 'uses_precomputed', # skip if PYWT_XSLOW environment variable found + 'matlab_result_dict_cwt', # dict with precomputed Matlab dwt data + 'matlab_result_dict_dwt', # dict with precomputed Matlab cwt data + 'futures', # the futures module or None + 'max_workers', # the number of workers available to futures + 'size_set', # the set of Matlab tests to run + ] + +try: + if sys.version_info[0] == 2: + import futures + else: + from concurrent import futures + max_workers = multiprocessing.cpu_count() + futures_available = True +except ImportError: + futures_available = False + futures = None + +# check if pymatbridge + MATLAB tests should be run +matlab_result_dict_dwt = None +matlab_result_dict_cwt = None +matlab_missing = True +use_precomputed = True +size_set = 'reduced' +if 'PYWT_XSLOW' in os.environ: + try: + from pymatbridge import Matlab + mlab = Matlab() + matlab_missing = False + use_precomputed = False + size_set = 'full' + except ImportError: + print("To run Matlab compatibility tests you need to have MathWorks " + "MATLAB, MathWorks Wavelet Toolbox and the pymatbridge Python " + "package installed.") +if use_precomputed: + # load dictionaries of precomputed results + data_dir = os.path.join(os.path.dirname(__file__), 'tests', 'data') + matlab_data_file_cwt = os.path.join( + data_dir, 'cwt_matlabR2015b_result.npz') + matlab_result_dict_cwt = np.load(matlab_data_file_cwt) + + matlab_data_file_dwt = os.path.join( + data_dir, 'dwt_matlabR2012a_result.npz') + matlab_result_dict_dwt = np.load(matlab_data_file_dwt) + +uses_futures = pytest.mark.skipif( + not futures_available, reason='futures not available') +uses_matlab = pytest.mark.skipif( + matlab_missing, reason='pymatbridge and/or Matlab not available') +uses_pymatbridge = pytest.mark.skipif( + use_precomputed, + reason='PYWT_XSLOW set: skipping tests against precomputed Matlab results') +uses_precomputed = pytest.mark.skipif( + not use_precomputed, + reason='PYWT_XSLOW not set: test against precomputed matlab tests') diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_pytesttester.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_pytesttester.py new file mode 100644 index 0000000000000000000000000000000000000000..426047a710970e2c6e7c3c22924ee07f9d07f042 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_pytesttester.py @@ -0,0 +1,164 @@ +""" +Pytest test running. + +This module implements the ``test()`` function for NumPy modules. The usual +boiler plate for doing that is to put the following in the module +``__init__.py`` file:: + + from pywt._pytesttester import PytestTester + test = PytestTester(__name__).test + del PytestTester + + +Warnings filtering and other runtime settings should be dealt with in the +``pytest.ini`` file in the pywt repo root. The behavior of the test depends on +whether or not that file is found as follows: + +* ``pytest.ini`` is present (develop mode) + All warnings except those explicily filtered out are raised as error. +* ``pytest.ini`` is absent (release mode) + DeprecationWarnings and PendingDeprecationWarnings are ignored, other + warnings are passed through. + +In practice, tests run from the PyWavelets repo are run in develop mode. That +includes the standard ``python runtests.py`` invocation. + +""" +from __future__ import division, absolute_import, print_function + +import sys +import os + +__all__ = ['PytestTester'] + + +def _show_pywt_info(): + import pywt + from pywt._c99_config import _have_c99_complex + print("PyWavelets version %s" % pywt.__version__) + if _have_c99_complex: + print("Compiled with C99 complex support.") + else: + print("Compiled without C99 complex support.") + + +class PytestTester(object): + """ + Pytest test runner. + + This class is made available in ``pywt.testing``, and a test function + is typically added to a package's __init__.py like so:: + + from pywt.testing import PytestTester + test = PytestTester(__name__).test + del PytestTester + + Calling this test function finds and runs all tests associated with the + module and all its sub-modules. + + Attributes + ---------- + module_name : str + Full path to the package to test. + + Parameters + ---------- + module_name : module name + The name of the module to test. + + """ + def __init__(self, module_name): + self.module_name = module_name + + def __call__(self, label='fast', verbose=1, extra_argv=None, + doctests=False, coverage=False, durations=-1, tests=None): + """ + Run tests for module using pytest. + + Parameters + ---------- + label : {'fast', 'full'}, optional + Identifies the tests to run. When set to 'fast', tests decorated + with `pytest.mark.slow` are skipped, when 'full', the slow marker + is ignored. + verbose : int, optional + Verbosity value for test outputs, in the range 1-3. Default is 1. + extra_argv : list, optional + List with any extra arguments to pass to pytests. + doctests : bool, optional + .. note:: Not supported + coverage : bool, optional + If True, report coverage of NumPy code. Default is False. + Requires installation of (pip) pytest-cov. + durations : int, optional + If < 0, do nothing, If 0, report time of all tests, if > 0, + report the time of the slowest `timer` tests. Default is -1. + tests : test or list of tests + Tests to be executed with pytest '--pyargs' + + Returns + ------- + result : bool + Return True on success, false otherwise. + + Examples + -------- + >>> result = np.lib.test() #doctest: +SKIP + ... + 1023 passed, 2 skipped, 6 deselected, 1 xfailed in 10.39 seconds + >>> result + True + + """ + import pytest + + module = sys.modules[self.module_name] + module_path = os.path.abspath(module.__path__[0]) + + # setup the pytest arguments + pytest_args = ["-l"] + + # offset verbosity. The "-q" cancels a "-v". + pytest_args += ["-q"] + + # Filter out annoying import messages. Want these in both develop and + # release mode. + pytest_args += [ + "-W ignore:Not importing directory", + "-W ignore:numpy.dtype size changed", + "-W ignore:numpy.ufunc size changed", ] + + if doctests: + raise ValueError("Doctests not supported") + + if extra_argv: + pytest_args += list(extra_argv) + + if verbose > 1: + pytest_args += ["-" + "v"*(verbose - 1)] + + if coverage: + pytest_args += ["--cov=" + module_path] + + if label == "fast": + pytest_args += ["-m", "not slow"] + elif label != "full": + pytest_args += ["-m", label] + + if durations >= 0: + pytest_args += ["--durations=%s" % durations] + + if tests is None: + tests = [self.module_name] + + pytest_args += ["--pyargs"] + list(tests) + + # run tests. + _show_pywt_info() + + try: + code = pytest.main(pytest_args) + except SystemExit as exc: + code = exc.code + + return code == 0 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_swt.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_swt.py new file mode 100644 index 0000000000000000000000000000000000000000..ac00336f9865dcdfb8a4eef4a7ab7fb64563d8be --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_swt.py @@ -0,0 +1,824 @@ +import warnings +from itertools import product + +import numpy as np + +from ._c99_config import _have_c99_complex +from ._extensions._dwt import idwt_single +from ._extensions._swt import swt_max_level, swt as _swt, swt_axis as _swt_axis +from ._extensions._pywt import Wavelet, Modes, _check_dtype +from ._multidim import idwt2, idwtn +from ._utils import _as_wavelet, _wavelets_per_axis + + +__all__ = ["swt", "swt_max_level", 'iswt', 'swt2', 'iswt2', 'swtn', 'iswtn'] + + +def _rescale_wavelet_filterbank(wavelet, sf): + wav = Wavelet(wavelet.name + 'r', + [np.asarray(f) * sf for f in wavelet.filter_bank]) + + # copy attributes from the original wavelet + wav.orthogonal = wavelet.orthogonal + wav.biorthogonal = wavelet.biorthogonal + return wav + + +def swt(data, wavelet, level=None, start_level=0, axis=-1, + trim_approx=False, norm=False): + """ + Multilevel 1D stationary wavelet transform. + + Parameters + ---------- + data : + Input signal + wavelet : + Wavelet to use (Wavelet object or name) + level : int, optional + The number of decomposition steps to perform. + start_level : int, optional + The level at which the decomposition will begin (it allows one to + skip a given number of transform steps and compute + coefficients starting from start_level) (default: 0) + axis: int, optional + Axis over which to compute the SWT. If not given, the + last axis is used. + trim_approx : bool, optional + If True, approximation coefficients at the final level are retained. + norm : bool, optional + If True, transform is normalized so that the energy of the coefficients + will be equal to the energy of ``data``. In other words, + ``np.linalg.norm(data.ravel())`` will equal the norm of the + concatenated transform coefficients when ``trim_approx`` is True. + + Returns + ------- + coeffs : list + List of approximation and details coefficients pairs in order + similar to wavedec function:: + + [(cAn, cDn), ..., (cA2, cD2), (cA1, cD1)] + + where n equals input parameter ``level``. + + If ``start_level = m`` is given, then the beginning m steps are + skipped:: + + [(cAm+n, cDm+n), ..., (cAm+1, cDm+1), (cAm, cDm)] + + If ``trim_approx`` is ``True``, then the output list is exactly as in + ``pywt.wavedec``, where the first coefficient in the list is the + approximation coefficient at the final level and the rest are the + detail coefficients:: + + [cAn, cDn, ..., cD2, cD1] + + Notes + ----- + The implementation here follows the "algorithm a-trous" and requires that + the signal length along the transformed axis be a multiple of ``2**level``. + If this is not the case, the user should pad up to an appropriate size + using a function such as ``numpy.pad``. + + A primary benefit of this transform in comparison to its decimated + counterpart (``pywt.wavedecn``), is that it is shift-invariant. This comes + at cost of redundancy in the transform (the size of the output coefficients + is larger than the input). + + When the following three conditions are true: + + 1. The wavelet is orthogonal + 2. ``swt`` is called with ``norm=True`` + 3. ``swt`` is called with ``trim_approx=True`` + + the transform has the following additional properties that may be + desirable in applications: + + 1. energy is conserved + 2. variance is partitioned across scales + + When used with ``norm=True``, this transform is closely related to the + multiple-overlap DWT (MODWT) as popularized for time-series analysis, + although the underlying implementation is slightly different from the one + published in [1]_. Specifically, the implementation used here requires a + signal that is a multiple of ``2**level`` in length. + + References + ---------- + .. [1] DB Percival and AT Walden. Wavelet Methods for Time Series Analysis. + Cambridge University Press, 2000. + """ + + if not _have_c99_complex and np.iscomplexobj(data): + data = np.asarray(data) + kwargs = dict(wavelet=wavelet, level=level, start_level=start_level, + trim_approx=trim_approx, axis=axis, norm=norm) + coeffs_real = swt(data.real, **kwargs) + coeffs_imag = swt(data.imag, **kwargs) + if not trim_approx: + coeffs_cplx = [] + for (cA_r, cD_r), (cA_i, cD_i) in zip(coeffs_real, coeffs_imag): + coeffs_cplx.append((cA_r + 1j*cA_i, cD_r + 1j*cD_i)) + else: + coeffs_cplx = [cr + 1j*ci + for (cr, ci) in zip(coeffs_real, coeffs_imag)] + return coeffs_cplx + + # accept array_like input; make a copy to ensure a contiguous array + dt = _check_dtype(data) + data = np.array(data, dtype=dt) + + wavelet = _as_wavelet(wavelet) + if norm: + if not wavelet.orthogonal: + warnings.warn( + "norm=True, but the wavelet is not orthogonal: \n" + "\tThe conditions for energy preservation are not satisfied.") + wavelet = _rescale_wavelet_filterbank(wavelet, 1/np.sqrt(2)) + + if axis < 0: + axis = axis + data.ndim + if not 0 <= axis < data.ndim: + raise np.AxisError("Axis greater than data dimensions") + + if level is None: + level = swt_max_level(data.shape[axis]) + + if data.ndim == 1: + ret = _swt(data, wavelet, level, start_level, trim_approx) + else: + ret = _swt_axis(data, wavelet, level, start_level, axis, trim_approx) + return ret + + +def iswt(coeffs, wavelet, norm=False, axis=-1): + """ + Multilevel 1D inverse discrete stationary wavelet transform. + + Parameters + ---------- + coeffs : array_like + Coefficients list of tuples:: + + [(cAn, cDn), ..., (cA2, cD2), (cA1, cD1)] + + where cA is approximation, cD is details. Index 1 corresponds to + ``start_level`` from ``pywt.swt``. + wavelet : Wavelet object or name string + Wavelet to use + norm : bool, optional + Controls the normalization used by the inverse transform. This must + be set equal to the value that was used by ``pywt.swt`` to preserve the + energy of a round-trip transform. + + Returns + ------- + 1D array of reconstructed data. + + Examples + -------- + >>> import pywt + >>> coeffs = pywt.swt([1,2,3,4,5,6,7,8], 'db2', level=2) + >>> pywt.iswt(coeffs, 'db2') + array([ 1., 2., 3., 4., 5., 6., 7., 8.]) + """ + # copy to avoid modification of input data + # If swt was called with trim_approx=False, first element is a tuple + trim_approx = not isinstance(coeffs[0], (tuple, list)) + cA = coeffs[0] if trim_approx else coeffs[0][0] + if cA.ndim > 1: + # convert to swtn coefficient format and call iswtn + if trim_approx: + coeffs_nd = [cA] + [{'d': d} for d in coeffs[1:]] + else: + coeffs_nd = [{'a': a, 'd': d} for a, d in coeffs] + return iswtn(coeffs_nd, wavelet, axes=(axis,), norm=norm) + elif axis != 0 and axis != -1: + raise np.AxisError("Axis greater than data dimensions") + if not _have_c99_complex and np.iscomplexobj(cA): + if trim_approx: + coeffs_real = [c.real for c in coeffs] + coeffs_imag = [c.imag for c in coeffs] + else: + coeffs_real = [(ca.real, cd.real) for ca, cd in coeffs] + coeffs_imag = [(ca.imag, cd.imag) for ca, cd in coeffs] + kwargs = dict(wavelet=wavelet, norm=norm) + y = iswt(coeffs_real, **kwargs) + return y + 1j * iswt(coeffs_imag, **kwargs) + + if trim_approx: + coeffs = coeffs[1:] + + if cA.ndim != 1: + raise ValueError("iswt only supports 1D data") + + dt = _check_dtype(cA) + output = np.array(cA, dtype=dt, copy=True) + + # num_levels, equivalent to the decomposition level, n + num_levels = len(coeffs) + wavelet = _as_wavelet(wavelet) + if norm: + wavelet = _rescale_wavelet_filterbank(wavelet, np.sqrt(2)) + mode = Modes.from_object('periodization') + for j in range(num_levels, 0, -1): + step_size = int(pow(2, j-1)) + last_index = step_size + if trim_approx: + cD = coeffs[-j] + else: + _, cD = coeffs[-j] + cD = np.asarray(cD, dtype=_check_dtype(cD)) + if cD.dtype != output.dtype: + # upcast to a common dtype (float64 or complex128) + if output.dtype.kind == 'c' or cD.dtype.kind == 'c': + dtype = np.complex128 + else: + dtype = np.float64 + output = np.asarray(output, dtype=dtype) + cD = np.asarray(cD, dtype=dtype) + for first in range(last_index): # 0 to last_index - 1 + + # Getting the indices that we will transform + indices = np.arange(first, len(cD), step_size) + + # select the even indices + even_indices = indices[0::2] + # select the odd indices + odd_indices = indices[1::2] + + # perform the inverse dwt on the selected indices, + # making sure to use periodic boundary conditions + # Note: indexing with an array of ints returns a contiguous + # copy as required by idwt_single. + x1 = idwt_single(output[even_indices], + cD[even_indices], + wavelet, mode) + x2 = idwt_single(output[odd_indices], + cD[odd_indices], + wavelet, mode) + + # perform a circular shift right + x2 = np.roll(x2, 1) + + # average and insert into the correct indices + output[indices] = (x1 + x2)/2. + + return output + + +def swt2(data, wavelet, level, start_level=0, axes=(-2, -1), + trim_approx=False, norm=False): + """ + Multilevel 2D stationary wavelet transform. + + Parameters + ---------- + data : array_like + 2D array with input data + wavelet : Wavelet object or name string, or 2-tuple of wavelets + Wavelet to use. This can also be a tuple of wavelets to apply per + axis in ``axes``. + level : int + The number of decomposition steps to perform. + start_level : int, optional + The level at which the decomposition will start (default: 0) + axes : 2-tuple of ints, optional + Axes over which to compute the SWT. Repeated elements are not allowed. + trim_approx : bool, optional + If True, approximation coefficients at the final level are retained. + norm : bool, optional + If True, transform is normalized so that the energy of the coefficients + will be equal to the energy of ``data``. In other words, + ``np.linalg.norm(data.ravel())`` will equal the norm of the + concatenated transform coefficients when ``trim_approx`` is True. + + Returns + ------- + coeffs : list + Approximation and details coefficients (for ``start_level = m``). + If ``trim_approx`` is ``False``, approximation coefficients are + retained for all levels:: + + [ + (cA_m+level, + (cH_m+level, cV_m+level, cD_m+level) + ), + ..., + (cA_m+1, + (cH_m+1, cV_m+1, cD_m+1) + ), + (cA_m, + (cH_m, cV_m, cD_m) + ) + ] + + where cA is approximation, cH is horizontal details, cV is + vertical details, cD is diagonal details and m is ``start_level``. + + If ``trim_approx`` is ``True``, approximation coefficients are only + retained at the final level of decomposition. This matches the format + used by ``pywt.wavedec2``:: + + [ + cA_m+level, + (cH_m+level, cV_m+level, cD_m+level), + ..., + (cH_m+1, cV_m+1, cD_m+1), + (cH_m, cV_m, cD_m), + ] + + Notes + ----- + The implementation here follows the "algorithm a-trous" and requires that + the signal length along the transformed axes be a multiple of ``2**level``. + If this is not the case, the user should pad up to an appropriate size + using a function such as ``numpy.pad``. + + A primary benefit of this transform in comparison to its decimated + counterpart (``pywt.wavedecn``), is that it is shift-invariant. This comes + at cost of redundancy in the transform (the size of the output coefficients + is larger than the input). + + When the following three conditions are true: + + 1. The wavelet is orthogonal + 2. ``swt2`` is called with ``norm=True`` + 3. ``swt2`` is called with ``trim_approx=True`` + + the transform has the following additional properties that may be + desirable in applications: + + 1. energy is conserved + 2. variance is partitioned across scales + + """ + axes = tuple(axes) + data = np.asarray(data) + if len(axes) != 2: + raise ValueError("Expected 2 axes") + if len(axes) != len(set(axes)): + raise ValueError("The axes passed to swt2 must be unique.") + if data.ndim < len(np.unique(axes)): + raise ValueError("Input array has fewer dimensions than the specified " + "axes") + + coefs = swtn(data, wavelet, level, start_level, axes, trim_approx, norm) + ret = [] + if trim_approx: + ret.append(coefs[0]) + coefs = coefs[1:] + for c in coefs: + if trim_approx: + ret.append((c['da'], c['ad'], c['dd'])) + else: + ret.append((c['aa'], (c['da'], c['ad'], c['dd']))) + return ret + + +def iswt2(coeffs, wavelet, norm=False, axes=(-2, -1)): + """ + Multilevel 2D inverse discrete stationary wavelet transform. + + Parameters + ---------- + coeffs : list + Approximation and details coefficients:: + + [ + (cA_n, + (cH_n, cV_n, cD_n) + ), + ..., + (cA_2, + (cH_2, cV_2, cD_2) + ), + (cA_1, + (cH_1, cV_1, cD_1) + ) + ] + + where cA is approximation, cH is horizontal details, cV is + vertical details, cD is diagonal details and n is the number of + levels. Index 1 corresponds to ``start_level`` from ``pywt.swt2``. + wavelet : Wavelet object or name string, or 2-tuple of wavelets + Wavelet to use. This can also be a 2-tuple of wavelets to apply per + axis. + norm : bool, optional + Controls the normalization used by the inverse transform. This must + be set equal to the value that was used by ``pywt.swt2`` to preserve + the energy of a round-trip transform. + + Returns + ------- + 2D array of reconstructed data. + + Examples + -------- + >>> import pywt + >>> coeffs = pywt.swt2([[1,2,3,4],[5,6,7,8], + ... [9,10,11,12],[13,14,15,16]], + ... 'db1', level=2) + >>> pywt.iswt2(coeffs, 'db1') + array([[ 1., 2., 3., 4.], + [ 5., 6., 7., 8.], + [ 9., 10., 11., 12.], + [ 13., 14., 15., 16.]]) + + """ + + # If swt was called with trim_approx=False, first element is a tuple + trim_approx = not isinstance(coeffs[0], (tuple, list)) + cA = coeffs[0] if trim_approx else coeffs[0][0] + if cA.ndim != 2 or axes != (-2, -1): + # convert to swtn coefficient format and call iswtn instead + if trim_approx: + coeffs_nd = [cA] + [{'da': h, 'ad': v, 'dd': d} + for h, v, d in coeffs[1:]] + else: + coeffs_nd = [{'aa': a, 'da': h, 'ad': v, 'dd': d} + for a, (h, v, d) in coeffs] + return iswtn(coeffs_nd, wavelet, axes=axes, norm=norm) + if not _have_c99_complex and np.iscomplexobj(cA): + if trim_approx: + coeffs_real = [cA.real] + coeffs_real += [(h.real, v.real, d.real) for h, v, d in coeffs[1:]] + coeffs_imag = [cA.imag] + coeffs_imag += [(h.imag, v.imag, d.imag) for h, v, d in coeffs[1:]] + else: + coeffs_real = [(a.real, (h.real, v.real, d.real)) + for a, (h, v, d) in coeffs] + coeffs_imag = [(a.imag, (h.imag, v.imag, d.imag)) + for a, (h, v, d) in coeffs] + kwargs = dict(wavelet=wavelet, norm=norm) + y = iswt2(coeffs_real, **kwargs) + return y + 1j * iswt2(coeffs_imag, **kwargs) + + if trim_approx: + coeffs = coeffs[1:] + + # copy to avoid modification of input data + dt = _check_dtype(cA) + output = np.array(cA, dtype=dt, copy=True) + + if output.ndim != 2: + raise ValueError( + "iswt2 only supports 2D arrays. see iswtn for a general " + "n-dimensionsal ISWT") + # num_levels, equivalent to the decomposition level, n + num_levels = len(coeffs) + wavelets = _wavelets_per_axis(wavelet, axes=(0, 1)) + if norm: + wavelets = [_rescale_wavelet_filterbank(wav, np.sqrt(2)) + for wav in wavelets] + + for j in range(num_levels): + step_size = int(pow(2, num_levels-j-1)) + last_index = step_size + if trim_approx: + (cH, cV, cD) = coeffs[j] + else: + _, (cH, cV, cD) = coeffs[j] + # We are going to assume cH, cV, and cD are of equal size + if (cH.shape != cV.shape) or (cH.shape != cD.shape): + raise RuntimeError( + "Mismatch in shape of intermediate coefficient arrays") + + # make sure output shares the common dtype + # (conversion of dtype for individual coeffs is handled within idwt2 ) + common_dtype = np.result_type(*( + [dt, ] + [_check_dtype(c) for c in [cH, cV, cD]])) + if output.dtype != common_dtype: + output = output.astype(common_dtype) + + for first_h in range(last_index): # 0 to last_index - 1 + for first_w in range(last_index): # 0 to last_index - 1 + # Getting the indices that we will transform + indices_h = slice(first_h, cH.shape[0], step_size) + indices_w = slice(first_w, cH.shape[1], step_size) + + even_idx_h = slice(first_h, cH.shape[0], 2*step_size) + even_idx_w = slice(first_w, cH.shape[1], 2*step_size) + odd_idx_h = slice(first_h + step_size, cH.shape[0], 2*step_size) + odd_idx_w = slice(first_w + step_size, cH.shape[1], 2*step_size) + + # perform the inverse dwt on the selected indices, + # making sure to use periodic boundary conditions + x1 = idwt2((output[even_idx_h, even_idx_w], + (cH[even_idx_h, even_idx_w], + cV[even_idx_h, even_idx_w], + cD[even_idx_h, even_idx_w])), + wavelets, 'periodization') + x2 = idwt2((output[even_idx_h, odd_idx_w], + (cH[even_idx_h, odd_idx_w], + cV[even_idx_h, odd_idx_w], + cD[even_idx_h, odd_idx_w])), + wavelets, 'periodization') + x3 = idwt2((output[odd_idx_h, even_idx_w], + (cH[odd_idx_h, even_idx_w], + cV[odd_idx_h, even_idx_w], + cD[odd_idx_h, even_idx_w])), + wavelets, 'periodization') + x4 = idwt2((output[odd_idx_h, odd_idx_w], + (cH[odd_idx_h, odd_idx_w], + cV[odd_idx_h, odd_idx_w], + cD[odd_idx_h, odd_idx_w])), + wavelets, 'periodization') + + # perform a circular shifts + x2 = np.roll(x2, 1, axis=1) + x3 = np.roll(x3, 1, axis=0) + x4 = np.roll(x4, 1, axis=0) + x4 = np.roll(x4, 1, axis=1) + output[indices_h, indices_w] = (x1 + x2 + x3 + x4) / 4 + + return output + + +def swtn(data, wavelet, level, start_level=0, axes=None, trim_approx=False, + norm=False): + """ + n-dimensional stationary wavelet transform. + + Parameters + ---------- + data : array_like + n-dimensional array with input data. + wavelet : Wavelet object or name string, or tuple of wavelets + Wavelet to use. This can also be a tuple of wavelets to apply per + axis in ``axes``. + level : int + The number of decomposition steps to perform. + start_level : int, optional + The level at which the decomposition will start (default: 0) + axes : sequence of ints, optional + Axes over which to compute the SWT. A value of ``None`` (the + default) selects all axes. Axes may not be repeated. + trim_approx : bool, optional + If True, approximation coefficients at the final level are retained. + norm : bool, optional + If True, transform is normalized so that the energy of the coefficients + will be equal to the energy of ``data``. In other words, + ``np.linalg.norm(data.ravel())`` will equal the norm of the + concatenated transform coefficients when ``trim_approx`` is True. + + Returns + ------- + [{coeffs_level_n}, ..., {coeffs_level_1}]: list of dict + Results for each level are arranged in a dictionary, where the key + specifies the transform type on each dimension and value is a + n-dimensional coefficients array. + + For example, for a 2D case the result at a given level will look + something like this:: + + {'aa': # A(LL) - approx. on 1st dim, approx. on 2nd dim + 'ad': # V(LH) - approx. on 1st dim, det. on 2nd dim + 'da': # H(HL) - det. on 1st dim, approx. on 2nd dim + 'dd': # D(HH) - det. on 1st dim, det. on 2nd dim + } + + For user-specified ``axes``, the order of the characters in the + dictionary keys map to the specified ``axes``. + + If ``trim_approx`` is ``True``, the first element of the list contains + the array of approximation coefficients from the final level of + decomposition, while the remaining coefficient dictionaries contain + only detail coefficients. This matches the behavior of `pywt.wavedecn`. + + Notes + ----- + The implementation here follows the "algorithm a-trous" and requires that + the signal length along the transformed axes be a multiple of ``2**level``. + If this is not the case, the user should pad up to an appropriate size + using a function such as ``numpy.pad``. + + A primary benefit of this transform in comparison to its decimated + counterpart (``pywt.wavedecn``), is that it is shift-invariant. This comes + at cost of redundancy in the transform (the size of the output coefficients + is larger than the input). + + When the following three conditions are true: + + 1. The wavelet is orthogonal + 2. ``swtn`` is called with ``norm=True`` + 3. ``swtn`` is called with ``trim_approx=True`` + + the transform has the following additional properties that may be + desirable in applications: + + 1. energy is conserved + 2. variance is partitioned across scales + + """ + data = np.asarray(data) + if not _have_c99_complex and np.iscomplexobj(data): + kwargs = dict(wavelet=wavelet, level=level, start_level=start_level, + trim_approx=trim_approx, axes=axes, norm=norm) + real = swtn(data.real, **kwargs) + imag = swtn(data.imag, **kwargs) + if trim_approx: + cplx = [real[0] + 1j * imag[0]] + offset = 1 + else: + cplx = [] + offset = 0 + for rdict, idict in zip(real[offset:], imag[offset:]): + cplx.append( + dict((k, rdict[k] + 1j * idict[k]) for k in rdict.keys())) + return cplx + + if data.dtype == np.dtype('object'): + raise TypeError("Input must be a numeric array-like") + if data.ndim < 1: + raise ValueError("Input data must be at least 1D") + + if axes is None: + axes = range(data.ndim) + axes = [a + data.ndim if a < 0 else a for a in axes] + if any(a < 0 or a >= data.ndim for a in axes): + raise np.AxisError("Axis greater than data dimensions") + if len(axes) != len(set(axes)): + raise ValueError("The axes passed to swtn must be unique.") + num_axes = len(axes) + + wavelets = _wavelets_per_axis(wavelet, axes) + if norm: + if not np.all([wav.orthogonal for wav in wavelets]): + warnings.warn( + "norm=True, but the wavelets used are not orthogonal: \n" + "\tThe conditions for energy preservation are not satisfied.") + wavelets = [_rescale_wavelet_filterbank(wav, 1/np.sqrt(2)) + for wav in wavelets] + ret = [] + for i in range(start_level, start_level + level): + coeffs = [('', data)] + for axis, wavelet in zip(axes, wavelets): + new_coeffs = [] + for subband, x in coeffs: + cA, cD = _swt_axis(x, wavelet, level=1, start_level=i, + axis=axis)[0] + new_coeffs.extend([(subband + 'a', cA), + (subband + 'd', cD)]) + coeffs = new_coeffs + + coeffs = dict(coeffs) + ret.append(coeffs) + + # data for the next level is the approximation coeffs from this level + data = coeffs['a' * num_axes] + if trim_approx: + coeffs.pop('a' * num_axes) + if trim_approx: + ret.append(data) + ret.reverse() + return ret + + +def iswtn(coeffs, wavelet, axes=None, norm=False): + """ + Multilevel nD inverse discrete stationary wavelet transform. + + Parameters + ---------- + coeffs : list + [{coeffs_level_n}, ..., {coeffs_level_1}]: list of dict + wavelet : Wavelet object or name string, or tuple of wavelets + Wavelet to use. This can also be a tuple of wavelets to apply per + axis in ``axes``. + axes : sequence of ints, optional + Axes over which to compute the inverse SWT. Axes may not be repeated. + The default is ``None``, which means transform all axes + (``axes = range(data.ndim)``). + norm : bool, optional + Controls the normalization used by the inverse transform. This must + be set equal to the value that was used by ``pywt.swtn`` to preserve + the energy of a round-trip transform. + + Returns + ------- + nD array of reconstructed data. + + Examples + -------- + >>> import pywt + >>> coeffs = pywt.swtn([[1,2,3,4],[5,6,7,8], + ... [9,10,11,12],[13,14,15,16]], + ... 'db1', level=2) + >>> pywt.iswtn(coeffs, 'db1') + array([[ 1., 2., 3., 4.], + [ 5., 6., 7., 8.], + [ 9., 10., 11., 12.], + [ 13., 14., 15., 16.]]) + + """ + + # key length matches the number of axes transformed + ndim_transform = max(len(key) for key in coeffs[-1].keys()) + trim_approx = not isinstance(coeffs[0], dict) + cA = coeffs[0] if trim_approx else coeffs[0]['a'*ndim_transform] + + if not _have_c99_complex and np.iscomplexobj(cA): + if trim_approx: + coeffs_real = [coeffs[0].real] + coeffs_imag = [coeffs[0].imag] + coeffs = coeffs[1:] + else: + coeffs_real = [] + coeffs_imag = [] + coeffs_real += [{k: v.real for k, v in c.items()} for c in coeffs] + coeffs_imag += [{k: v.imag for k, v in c.items()} for c in coeffs] + kwargs = dict(wavelet=wavelet, axes=axes, norm=norm) + y = iswtn(coeffs_real, **kwargs) + return y + 1j * iswtn(coeffs_imag, **kwargs) + + if trim_approx: + coeffs = coeffs[1:] + + # copy to avoid modification of input data + dt = _check_dtype(cA) + output = np.array(cA, dtype=dt, copy=True) + ndim = output.ndim + + if axes is None: + axes = range(output.ndim) + axes = [a + ndim if a < 0 else a for a in axes] + if len(axes) != len(set(axes)): + raise ValueError("The axes passed to swtn must be unique.") + if ndim_transform != len(axes): + raise ValueError("The number of axes used in iswtn must match the " + "number of dimensions transformed in swtn.") + + # num_levels, equivalent to the decomposition level, n + num_levels = len(coeffs) + wavelets = _wavelets_per_axis(wavelet, axes) + if norm: + wavelets = [_rescale_wavelet_filterbank(wav, np.sqrt(2)) + for wav in wavelets] + + # initialize various slice objects used in the loops below + # these will remain slice(None) only on axes that aren't transformed + indices = [slice(None), ]*ndim + even_indices = [slice(None), ]*ndim + odd_indices = [slice(None), ]*ndim + odd_even_slices = [slice(None), ]*ndim + + for j in range(num_levels): + step_size = int(pow(2, num_levels-j-1)) + last_index = step_size + if not trim_approx: + a = coeffs[j].pop('a'*ndim_transform) # will restore later + details = coeffs[j] + # make sure dtype matches the coarsest level approximation coefficients + common_dtype = np.result_type(*( + [dt, ] + [v.dtype for v in details.values()])) + if output.dtype != common_dtype: + output = output.astype(common_dtype) + + # We assume all coefficient arrays are of equal size + shapes = [v.shape for k, v in details.items()] + if len(set(shapes)) != 1: + raise RuntimeError( + "Mismatch in shape of intermediate coefficient arrays") + + # shape of a single coefficient array, excluding non-transformed axes + coeff_trans_shape = tuple([shapes[0][ax] for ax in axes]) + + # nested loop over all combinations of axis offsets at this level + for firsts in product(*([range(last_index), ]*ndim_transform)): + for first, sh, ax in zip(firsts, coeff_trans_shape, axes): + indices[ax] = slice(first, sh, step_size) + even_indices[ax] = slice(first, sh, 2*step_size) + odd_indices[ax] = slice(first+step_size, sh, 2*step_size) + + # nested loop over all combinations of odd/even inidices + approx = output.copy() + output[tuple(indices)] = 0 + ntransforms = 0 + for odds in product(*([(0, 1), ]*ndim_transform)): + for o, ax in zip(odds, axes): + if o: + odd_even_slices[ax] = odd_indices[ax] + else: + odd_even_slices[ax] = even_indices[ax] + # extract the odd/even indices for all detail coefficients + details_slice = {} + for key, value in details.items(): + details_slice[key] = value[tuple(odd_even_slices)] + details_slice['a'*ndim_transform] = approx[ + tuple(odd_even_slices)] + + # perform the inverse dwt on the selected indices, + # making sure to use periodic boundary conditions + x = idwtn(details_slice, wavelets, 'periodization', axes=axes) + for o, ax in zip(odds, axes): + # circular shift along any odd indexed axis + if o: + x = np.roll(x, 1, axis=ax) + output[tuple(indices)] += x + ntransforms += 1 + output[tuple(indices)] /= ntransforms # normalize + if not trim_approx: + coeffs[j]['a'*ndim_transform] = a # restore approx coeffs to dict + return output diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_thresholding.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_thresholding.py new file mode 100644 index 0000000000000000000000000000000000000000..286f61179b2f6616075711fc5df82d1f66fe6018 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_thresholding.py @@ -0,0 +1,250 @@ +# Copyright (c) 2006-2012 Filip Wasilewski +# Copyright (c) 2012-2016 The PyWavelets Developers +# +# See COPYING for license details. + +""" +The thresholding helper module implements the most popular signal thresholding +functions. +""" + +from __future__ import division, print_function, absolute_import +import numpy as np + +__all__ = ['threshold', 'threshold_firm'] + + +def soft(data, value, substitute=0): + data = np.asarray(data) + magnitude = np.absolute(data) + + with np.errstate(divide='ignore'): + # divide by zero okay as np.inf values get clipped, so ignore warning. + thresholded = (1 - value/magnitude) + thresholded.clip(min=0, max=None, out=thresholded) + thresholded = data * thresholded + + if substitute == 0: + return thresholded + else: + cond = np.less(magnitude, value) + return np.where(cond, substitute, thresholded) + + +def nn_garrote(data, value, substitute=0): + """Non-negative Garrote.""" + data = np.asarray(data) + magnitude = np.absolute(data) + + with np.errstate(divide='ignore'): + # divide by zero okay as np.inf values get clipped, so ignore warning. + thresholded = (1 - value**2/magnitude**2) + thresholded.clip(min=0, max=None, out=thresholded) + thresholded = data * thresholded + + if substitute == 0: + return thresholded + else: + cond = np.less(magnitude, value) + return np.where(cond, substitute, thresholded) + + +def hard(data, value, substitute=0): + data = np.asarray(data) + cond = np.less(np.absolute(data), value) + return np.where(cond, substitute, data) + + +def greater(data, value, substitute=0): + data = np.asarray(data) + if np.iscomplexobj(data): + raise ValueError("greater thresholding only supports real data") + return np.where(np.less(data, value), substitute, data) + + +def less(data, value, substitute=0): + data = np.asarray(data) + if np.iscomplexobj(data): + raise ValueError("less thresholding only supports real data") + return np.where(np.greater(data, value), substitute, data) + + +thresholding_options = {'soft': soft, + 'hard': hard, + 'greater': greater, + 'less': less, + 'garrote': nn_garrote, + # misspelled garrote for backwards compatibility + 'garotte': nn_garrote, + } + + +def threshold(data, value, mode='soft', substitute=0): + """ + Thresholds the input data depending on the mode argument. + + In ``soft`` thresholding [1]_, data values with absolute value less than + `param` are replaced with `substitute`. Data values with absolute value + greater or equal to the thresholding value are shrunk toward zero + by `value`. In other words, the new value is + ``data/np.abs(data) * np.maximum(np.abs(data) - value, 0)``. + + In ``hard`` thresholding, the data values where their absolute value is + less than the value param are replaced with `substitute`. Data values with + absolute value greater or equal to the thresholding value stay untouched. + + ``garrote`` corresponds to the Non-negative garrote threshold [2]_, [3]_. + It is intermediate between ``hard`` and ``soft`` thresholding. It behaves + like soft thresholding for small data values and approaches hard + thresholding for large data values. + + In ``greater`` thresholding, the data is replaced with `substitute` where + data is below the thresholding value. Greater data values pass untouched. + + In ``less`` thresholding, the data is replaced with `substitute` where data + is above the thresholding value. Lesser data values pass untouched. + + Both ``hard`` and ``soft`` thresholding also support complex-valued data. + + Parameters + ---------- + data : array_like + Numeric data. + value : scalar + Thresholding value. + mode : {'soft', 'hard', 'garrote', 'greater', 'less'} + Decides the type of thresholding to be applied on input data. Default + is 'soft'. + substitute : float, optional + Substitute value (default: 0). + + Returns + ------- + output : array + Thresholded array. + + See Also + -------- + threshold_firm + + References + ---------- + .. [1] D.L. Donoho and I.M. Johnstone. Ideal Spatial Adaptation via + Wavelet Shrinkage. Biometrika. Vol. 81, No. 3, pp.425-455, 1994. + DOI:10.1093/biomet/81.3.425 + .. [2] L. Breiman. Better Subset Regression Using the Nonnegative Garrote. + Technometrics, Vol. 37, pp. 373-384, 1995. + DOI:10.2307/1269730 + .. [3] H-Y. Gao. Wavelet Shrinkage Denoising Using the Non-Negative + Garrote. Journal of Computational and Graphical Statistics Vol. 7, + No. 4, pp.469-488. 1998. + DOI:10.1080/10618600.1998.10474789 + + Examples + -------- + >>> import numpy as np + >>> import pywt + >>> data = np.linspace(1, 4, 7) + >>> data + array([ 1. , 1.5, 2. , 2.5, 3. , 3.5, 4. ]) + >>> pywt.threshold(data, 2, 'soft') + array([ 0. , 0. , 0. , 0.5, 1. , 1.5, 2. ]) + >>> pywt.threshold(data, 2, 'hard') + array([ 0. , 0. , 2. , 2.5, 3. , 3.5, 4. ]) + >>> pywt.threshold(data, 2, 'garrote') + array([ 0. , 0. , 0. , 0.9 , 1.66666667, + 2.35714286, 3. ]) + >>> pywt.threshold(data, 2, 'greater') + array([ 0. , 0. , 2. , 2.5, 3. , 3.5, 4. ]) + >>> pywt.threshold(data, 2, 'less') + array([ 1. , 1.5, 2. , 0. , 0. , 0. , 0. ]) + + """ + + try: + return thresholding_options[mode](data, value, substitute) + except KeyError: + # Make sure error is always identical by sorting keys + keys = ("'{0}'".format(key) for key in + sorted(thresholding_options.keys())) + raise ValueError("The mode parameter only takes values from: {0}." + .format(', '.join(keys))) + + +def threshold_firm(data, value_low, value_high): + """Firm threshold. + + The approach is intermediate between soft and hard thresholding [1]_. It + behaves the same as soft-thresholding for values below `value_low` and + the same as hard-thresholding for values above `thresh_high`. For + intermediate values, the thresholded value is in between that corresponding + to soft or hard thresholding. + + Parameters + ---------- + data : array-like + The data to threshold. This can be either real or complex-valued. + value_low : float + Any values smaller then `value_low` will be set to zero. + value_high : float + Any values larger than `value_high` will not be modified. + + Notes + ----- + This thresholding technique is also known as semi-soft thresholding [2]_. + + For each value, `x`, in `data`. This function computes:: + + if np.abs(x) <= value_low: + return 0 + elif np.abs(x) > value_high: + return x + elif value_low < np.abs(x) and np.abs(x) <= value_high: + return x * value_high * (1 - value_low/x)/(value_high - value_low) + + ``firm`` is a continuous function (like soft thresholding), but is + unbiased for large values (like hard thresholding). + + If ``value_high == value_low`` this function becomes hard-thresholding. + If ``value_high`` is infinity, this function becomes soft-thresholding. + + Returns + ------- + val_new : array-like + The values after firm thresholding at the specified thresholds. + + See Also + -------- + threshold + + References + ---------- + .. [1] H.-Y. Gao and A.G. Bruce. Waveshrink with firm shrinkage. + Statistica Sinica, Vol. 7, pp. 855-874, 1997. + .. [2] A. Bruce and H-Y. Gao. WaveShrink: Shrinkage Functions and + Thresholds. Proc. SPIE 2569, Wavelet Applications in Signal and + Image Processing III, 1995. + DOI:10.1117/12.217582 + """ + + if value_low < 0: + raise ValueError("value_low must be non-negative.") + + if value_high < value_low: + raise ValueError( + "value_high must be greater than or equal to value_low.") + + data = np.asarray(data) + magnitude = np.absolute(data) + with np.errstate(divide='ignore'): + # divide by zero okay as np.inf values get clipped, so ignore warning. + vdiff = value_high - value_low + thresholded = value_high * (1 - value_low/magnitude) / vdiff + thresholded.clip(min=0, max=None, out=thresholded) + thresholded = data * thresholded + + # restore hard-thresholding behavior for values > value_high + large_vals = np.where(magnitude > value_high) + if np.any(large_vals[0]): + thresholded[large_vals] = data[large_vals] + return thresholded diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_utils.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..291e85070c8b7f1ae64e1fa4e33ded943194eede --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_utils.py @@ -0,0 +1,101 @@ +# Copyright (c) 2017 The PyWavelets Developers +# +# See COPYING for license details. +import inspect +import numpy as np +import sys +from collections.abc import Iterable + +from ._extensions._pywt import (Wavelet, ContinuousWavelet, + DiscreteContinuousWavelet, Modes) + + +# define string_types as in six for Python 2/3 compatibility +if sys.version_info[0] == 3: + string_types = str, +else: + string_types = basestring, + + +def _as_wavelet(wavelet): + """Convert wavelet name to a Wavelet object.""" + if not isinstance(wavelet, (ContinuousWavelet, Wavelet)): + wavelet = DiscreteContinuousWavelet(wavelet) + if isinstance(wavelet, ContinuousWavelet): + raise ValueError( + "A ContinuousWavelet object was provided, but only discrete " + "Wavelet objects are supported by this function. A list of all " + "supported discrete wavelets can be obtained by running:\n" + "print(pywt.wavelist(kind='discrete'))") + return wavelet + + +def _wavelets_per_axis(wavelet, axes): + """Initialize Wavelets for each axis to be transformed. + + Parameters + ---------- + wavelet : Wavelet or tuple of Wavelets + If a single Wavelet is provided, it will used for all axes. Otherwise + one Wavelet per axis must be provided. + axes : list + The tuple of axes to be transformed. + + Returns + ------- + wavelets : list of Wavelet objects + A tuple of Wavelets equal in length to ``axes``. + + """ + axes = tuple(axes) + if isinstance(wavelet, string_types + (Wavelet, )): + # same wavelet on all axes + wavelets = [_as_wavelet(wavelet), ] * len(axes) + elif isinstance(wavelet, Iterable): + # (potentially) unique wavelet per axis (e.g. for dual-tree DWT) + if len(wavelet) == 1: + wavelets = [_as_wavelet(wavelet[0]), ] * len(axes) + else: + if len(wavelet) != len(axes): + raise ValueError(( + "The number of wavelets must match the number of axes " + "to be transformed.")) + wavelets = [_as_wavelet(w) for w in wavelet] + else: + raise ValueError("wavelet must be a str, Wavelet or iterable") + return wavelets + + +def _modes_per_axis(modes, axes): + """Initialize mode for each axis to be transformed. + + Parameters + ---------- + modes : str or tuple of strings + If a single mode is provided, it will used for all axes. Otherwise + one mode per axis must be provided. + axes : tuple + The tuple of axes to be transformed. + + Returns + ------- + modes : tuple of int + A tuple of Modes equal in length to ``axes``. + + """ + axes = tuple(axes) + if isinstance(modes, string_types + (int, )): + # same wavelet on all axes + modes = [Modes.from_object(modes), ] * len(axes) + elif isinstance(modes, Iterable): + if len(modes) == 1: + modes = [Modes.from_object(modes[0]), ] * len(axes) + else: + # (potentially) unique wavelet per axis (e.g. for dual-tree DWT) + if len(modes) != len(axes): + raise ValueError(("The number of modes must match the number " + "of axes to be transformed.")) + modes = [Modes.from_object(mode) for mode in modes] + else: + raise ValueError("modes must be a str, Mode enum or iterable") + return modes diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_wavelet_packets.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_wavelet_packets.py new file mode 100644 index 0000000000000000000000000000000000000000..a9344eaf7120348f7b8323a6bf8869bb1875232a --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/_wavelet_packets.py @@ -0,0 +1,1056 @@ +# Copyright (c) 2006-2012 Filip Wasilewski +# Copyright (c) 2012-2016 The PyWavelets Developers +# +# See COPYING for license details. + +"""1D and 2D Wavelet packet transform module.""" + +from __future__ import division, print_function, absolute_import + +__all__ = ["BaseNode", "Node", "WaveletPacket", "Node2D", "WaveletPacket2D", + "NodeND", "WaveletPacketND"] + +from itertools import product +from collections import OrderedDict +import numpy as np + +from ._extensions._pywt import Wavelet, _check_dtype +from ._dwt import dwt, idwt, dwt_max_level +from ._multidim import dwt2, idwt2, dwtn, idwtn + + +def get_graycode_order(level, x='a', y='d'): + graycode_order = [x, y] + for i in range(level - 1): + graycode_order = [x + path for path in graycode_order] + \ + [y + path for path in graycode_order[::-1]] + return graycode_order + + +class BaseNode(object): + """ + BaseNode for wavelet packet 1D and 2D tree nodes. + + The BaseNode is a base class for `Node` and `Node2D`. + It should not be used directly unless creating a new transformation + type. It is included here to document the common interface of 1D + and 2D node and wavelet packet transform classes. + + Parameters + ---------- + parent : + Parent node. If parent is None then the node is considered detached + (ie root). + data : 1D or 2D array + Data associated with the node. 1D or 2D numeric array, depending on the + transform type. + node_name : + A name identifying the coefficients type. + See `Node.node_name` and `Node2D.node_name` + for information on the accepted subnodes names. + """ + + # PART_LEN and PARTS attributes that define path tokens for node[] lookup + # must be defined in subclasses. + PART_LEN = None + PARTS = None + + def __init__(self, parent, data, node_name): + self.parent = parent + if parent is not None: + self.wavelet = parent.wavelet + self.mode = parent.mode + self.level = parent.level + 1 + self._maxlevel = parent.maxlevel + self.path = parent.path + node_name + self.axes = parent.axes + else: + self.wavelet = None + self.mode = None + self.axes = None + self.path = "" + self.level = 0 + + # data - signal on level 0, coeffs on higher levels + self.data = data + # Need to retain original data size/shape so we can trim any excess + # boundary coefficients from the inverse transform. + if self.data is None: + self._data_shape = None + else: + self._data_shape = np.asarray(data).shape + + self._init_subnodes() + + def _init_subnodes(self): + for part in self.PARTS: + self._set_node(part, None) + + def _create_subnode(self, part, data=None, overwrite=True): + raise NotImplementedError() + + def _create_subnode_base(self, node_cls, part, data=None, overwrite=True, + **kwargs): + self._validate_node_name(part) + if not overwrite and self._get_node(part) is not None: + return self._get_node(part) + node = node_cls(self, data, part, **kwargs) + self._set_node(part, node) + return node + + def _get_node(self, part): + return getattr(self, part) + + def _set_node(self, part, node): + setattr(self, part, node) + + def _delete_node(self, part): + self._set_node(part, None) + + def _validate_node_name(self, part): + if part not in self.PARTS: + raise ValueError("Subnode name must be in [%s], not '%s'." % + (', '.join("'%s'" % p for p in self.PARTS), part)) + + @property + def path_tuple(self): + """The path to the current node in tuple form. + + The length of the tuple is equal to the number of decomposition levels. + """ + path = self.path + nlev = len(path)//self.PART_LEN + return tuple([path[(n-1)*self.PART_LEN:n*self.PART_LEN] + for n in range(1, nlev+1)]) + + def _evaluate_maxlevel(self, evaluate_from='parent'): + """ + Try to find the value of maximum decomposition level if it is not + specified explicitly. + + Parameters + ---------- + evaluate_from : {'parent', 'subnodes'} + """ + assert evaluate_from in ('parent', 'subnodes') + + if self._maxlevel is not None: + return self._maxlevel + elif self.data is not None: + return self.level + dwt_max_level( + min(self.data.shape), self.wavelet) + + if evaluate_from == 'parent': + if self.parent is not None: + return self.parent._evaluate_maxlevel(evaluate_from) + elif evaluate_from == 'subnodes': + for node_name in self.PARTS: + node = getattr(self, node_name, None) + if node is not None: + level = node._evaluate_maxlevel(evaluate_from) + if level is not None: + return level + return None + + @property + def maxlevel(self): + if self._maxlevel is not None: + return self._maxlevel + + # Try getting the maxlevel from parents first + self._maxlevel = self._evaluate_maxlevel(evaluate_from='parent') + + # If not found, check whether it can be evaluated from subnodes + if self._maxlevel is None: + self._maxlevel = self._evaluate_maxlevel(evaluate_from='subnodes') + return self._maxlevel + + @property + def node_name(self): + return self.path[-self.PART_LEN:] + + def decompose(self): + """ + Decompose node data creating DWT coefficients subnodes. + + Performs Discrete Wavelet Transform on the `~BaseNode.data` and + returns transform coefficients. + + Note + ---- + Descends to subnodes and recursively + calls `~BaseNode.reconstruct` on them. + + """ + if self.level < self.maxlevel: + return self._decompose() + else: + raise ValueError("Maximum decomposition level reached.") + + def _decompose(self): + raise NotImplementedError() + + def reconstruct(self, update=False): + """ + Reconstruct node from subnodes. + + Parameters + ---------- + update : bool, optional + If True, then reconstructed data replaces the current + node data (default: False). + + Returns: + - original node data if subnodes do not exist + - IDWT of subnodes otherwise. + """ + if not self.has_any_subnode: + return self.data + return self._reconstruct(update) + + def _reconstruct(self): + raise NotImplementedError() # override this in subclasses + + def get_subnode(self, part, decompose=True): + """ + Returns subnode or None (see `decomposition` flag description). + + Parameters + ---------- + part : + Subnode name + decompose : bool, optional + If the param is True and corresponding subnode does not + exist, the subnode will be created using coefficients + from the DWT decomposition of the current node. + (default: True) + """ + self._validate_node_name(part) + subnode = self._get_node(part) + if subnode is None and decompose and not self.is_empty: + self.decompose() + subnode = self._get_node(part) + return subnode + + def __getitem__(self, path): + """ + Find node represented by the given path. + + Similar to `~BaseNode.get_subnode` method with `decompose=True`, but + can access nodes on any level in the decomposition tree. + + Parameters + ---------- + path : str + String composed of node names. See `Node.node_name` and + `Node2D.node_name` for node naming convention. + + Notes + ----- + If node does not exist yet, it will be created by decomposition of its + parent node. + """ + errmsg = ("Invalid path parameter type - expected string or " + "tuple of strings but got %s." % type(path)) + if isinstance(path, tuple): + # concatenate tuple of strings into a single string + try: + path = ''.join(path) + except TypeError: + raise TypeError(errmsg) + if isinstance(path, str): + if (self.maxlevel is not None and + len(path) > self.maxlevel * self.PART_LEN): + raise IndexError("Path length is out of range.") + if path: + return self.get_subnode(path[0:self.PART_LEN], True)[ + path[self.PART_LEN:]] + else: + return self + else: + raise TypeError(errmsg) + + def __setitem__(self, path, data): + """ + Set node or node's data in the decomposition tree. Nodes are + identified by string `path`. + + Parameters + ---------- + path : str + String composed of node names. + data : array or BaseNode subclass. + """ + + if isinstance(path, str): + if ( + self.maxlevel is not None and + len(self.path) + len(path) > self.maxlevel * self.PART_LEN + ): + raise IndexError("Path length out of range.") + if path: + subnode = self.get_subnode(path[0:self.PART_LEN], False) + if subnode is None: + self._create_subnode(path[0:self.PART_LEN], None) + subnode = self.get_subnode(path[0:self.PART_LEN], False) + subnode[path[self.PART_LEN:]] = data + else: + if isinstance(data, BaseNode): + self.data = np.asarray(data.data) + else: + self.data = np.asarray(data) + # convert data to nearest supported dtype + dtype = _check_dtype(data) + if self.data.dtype != dtype: + self.data = self.data.astype(dtype) + else: + raise TypeError("Invalid path parameter type - expected string but" + " got %s." % type(path)) + + def __delitem__(self, path): + """ + Remove node from the tree. + + Parameters + ---------- + path : str + String composed of node names. + """ + node = self[path] + # don't clear node value and subnodes (node may still exist outside + # the tree) + # # node._init_subnodes() + # # node.data = None + parent = node.parent + node.parent = None # TODO + if parent and node.node_name: + parent._delete_node(node.node_name) + + @property + def is_empty(self): + return self.data is None + + @property + def has_any_subnode(self): + for part in self.PARTS: + if self._get_node(part) is not None: # and not .is_empty + return True + return False + + def get_leaf_nodes(self, decompose=False): + """ + Returns leaf nodes. + + Parameters + ---------- + decompose : bool, optional + (default: True) + """ + result = [] + + def collect(node): + if node.level == node.maxlevel and not node.is_empty: + result.append(node) + return False + if not decompose and not node.has_any_subnode: + result.append(node) + return False + return True + self.walk(collect, decompose=decompose) + return result + + def walk(self, func, args=(), kwargs=None, decompose=True): + """ + Traverses the decomposition tree and calls + ``func(node, *args, **kwargs)`` on every node. If `func` returns True, + descending to subnodes will continue. + + Parameters + ---------- + func : callable + Callable accepting `BaseNode` as the first param and + optional positional and keyword arguments + args : + func params + kwargs : + func keyword params + decompose : bool, optional + If True (default), the method will also try to decompose the tree + up to the `maximum level `. + """ + if kwargs is None: + kwargs = {} + if func(self, *args, **kwargs) and self.level < self.maxlevel: + for part in self.PARTS: + subnode = self.get_subnode(part, decompose) + if subnode is not None: + subnode.walk(func, args, kwargs, decompose) + + def walk_depth(self, func, args=(), kwargs=None, decompose=True): + """ + Walk tree and call func on every node starting from the bottom-most + nodes. + + Parameters + ---------- + func : callable + Callable accepting :class:`BaseNode` as the first param and + optional positional and keyword arguments + args : + func params + kwargs : + func keyword params + decompose : bool, optional + (default: False) + """ + if kwargs is None: + kwargs = {} + if self.level < self.maxlevel: + for part in self.PARTS: + subnode = self.get_subnode(part, decompose) + if subnode is not None: + subnode.walk_depth(func, args, kwargs, decompose) + func(self, *args, **kwargs) + + def __str__(self): + return self.path + ": " + str(self.data) + + +class Node(BaseNode): + """ + WaveletPacket tree node. + + Subnodes are called `a` and `d`, just like approximation + and detail coefficients in the Discrete Wavelet Transform. + """ + + A = 'a' + D = 'd' + PARTS = A, D + PART_LEN = 1 + + def _create_subnode(self, part, data=None, overwrite=True): + return self._create_subnode_base(node_cls=Node, part=part, data=data, + overwrite=overwrite) + + def _decompose(self): + """ + + See also + -------- + dwt : for 1D Discrete Wavelet Transform output coefficients. + """ + if self.is_empty: + data_a, data_d = None, None + if self._get_node(self.A) is None: + self._create_subnode(self.A, data_a) + if self._get_node(self.D) is None: + self._create_subnode(self.D, data_d) + else: + data_a, data_d = dwt(self.data, self.wavelet, self.mode, + axis=self.axes) + self._create_subnode(self.A, data_a) + self._create_subnode(self.D, data_d) + return self._get_node(self.A), self._get_node(self.D) + + def _reconstruct(self, update): + data_a, data_d = None, None + node_a, node_d = self._get_node(self.A), self._get_node(self.D) + + if node_a is not None: + data_a = node_a.reconstruct() # TODO: (update) ??? + if node_d is not None: + data_d = node_d.reconstruct() # TODO: (update) ??? + + if data_a is None and data_d is None: + raise ValueError("Node is a leaf node and cannot be reconstructed" + " from subnodes.") + else: + rec = idwt(data_a, data_d, self.wavelet, self.mode, axis=self.axes) + if self._data_shape is not None and ( + rec.shape != self._data_shape): + rec = rec[tuple([slice(sz) for sz in self._data_shape])] + if update: + self.data = rec + return rec + + +class Node2D(BaseNode): + """ + WaveletPacket tree node. + + Subnodes are called 'a' (LL), 'h' (HL), 'v' (LH) and 'd' (HH), like + approximation and detail coefficients in the 2D Discrete Wavelet Transform + """ + + LL = 'a' + HL = 'h' + LH = 'v' + HH = 'd' + + PARTS = LL, HL, LH, HH + PART_LEN = 1 + + def _create_subnode(self, part, data=None, overwrite=True): + return self._create_subnode_base(node_cls=Node2D, part=part, data=data, + overwrite=overwrite) + + def _decompose(self): + """ + See also + -------- + dwt2 : for 2D Discrete Wavelet Transform output coefficients. + """ + if self.is_empty: + data_ll, data_lh, data_hl, data_hh = None, None, None, None + else: + data_ll, (data_hl, data_lh, data_hh) =\ + dwt2(self.data, self.wavelet, self.mode, axes=self.axes) + self._create_subnode(self.LL, data_ll) + self._create_subnode(self.LH, data_lh) + self._create_subnode(self.HL, data_hl) + self._create_subnode(self.HH, data_hh) + return (self._get_node(self.LL), self._get_node(self.HL), + self._get_node(self.LH), self._get_node(self.HH)) + + def _reconstruct(self, update): + data_ll, data_lh, data_hl, data_hh = None, None, None, None + + node_ll, node_lh, node_hl, node_hh =\ + self._get_node(self.LL), self._get_node(self.LH),\ + self._get_node(self.HL), self._get_node(self.HH) + + if node_ll is not None: + data_ll = node_ll.reconstruct() + if node_lh is not None: + data_lh = node_lh.reconstruct() + if node_hl is not None: + data_hl = node_hl.reconstruct() + if node_hh is not None: + data_hh = node_hh.reconstruct() + + if (data_ll is None and data_lh is None and + data_hl is None and data_hh is None): + raise ValueError( + "Tree is missing data - all subnodes of `%s` node " + "are None. Cannot reconstruct node." % self.path + ) + else: + coeffs = data_ll, (data_hl, data_lh, data_hh) + rec = idwt2(coeffs, self.wavelet, self.mode, axes=self.axes) + if self._data_shape is not None and ( + rec.shape != self._data_shape): + rec = rec[tuple([slice(sz) for sz in self._data_shape])] + if update: + self.data = rec + return rec + + def expand_2d_path(self, path): + expanded_paths = { + self.HH: 'hh', + self.HL: 'hl', + self.LH: 'lh', + self.LL: 'll' + } + return (''.join([expanded_paths[p][0] for p in path]), + ''.join([expanded_paths[p][1] for p in path])) + + +class NodeND(BaseNode): + """ + WaveletPacket tree node. + + Unlike Node and Node2D self.PARTS is a dictionary. + For 1D: self.PARTS has keys 'a' and 'd' + For 2D: self.PARTS has keys 'aa', 'ad', 'da', 'dd' + For 3D: self.PARTS has keys 'aaa', 'aad', 'ada', 'daa', ..., 'ddd' + + Parameters + ---------- + parent : + Parent node. If parent is None then the node is considered detached + (ie root). + data : 1D or 2D array + Data associated with the node. 1D or 2D numeric array, depending on the + transform type. + node_name : string + A name identifying the coefficients type. + See `Node.node_name` and `Node2D.node_name` + for information on the accepted subnodes names. + ndim : int + The number of data dimensions. + ndim_transform : int + The number of dimensions that are to be transformed. + + """ + def __init__(self, parent, data, node_name, ndim, ndim_transform): + super(NodeND, self).__init__(parent=parent, data=data, + node_name=node_name) + self.PART_LEN = ndim_transform + self.PARTS = OrderedDict() + for key in product(*(('ad', )*self.PART_LEN)): + self.PARTS[''.join(key)] = None + self.ndim = ndim + self.ndim_transform = ndim_transform + + def _init_subnodes(self): + # need this empty so BaseNode's _init_subnodes isn't called during + # __init__. We use a dictionary for PARTS instead for the nd case. + pass + + def _get_node(self, part): + return self.PARTS[part] + + def _set_node(self, part, node): + if part not in self.PARTS: + raise ValueError("invalid part") + self.PARTS[part] = node + + def _delete_node(self, part): + self._set_node(part, None) + + def _validate_node_name(self, part): + if part not in self.PARTS: + raise ValueError( + "Subnode name must be in [%s], not '%s'." % + (', '.join("'%s'" % p for p in list(self.PARTS.keys())), part)) + + def _create_subnode(self, part, data=None, overwrite=True): + return self._create_subnode_base(node_cls=NodeND, part=part, data=data, + overwrite=overwrite, ndim=self.ndim, + ndim_transform=self.ndim_transform) + + def _evaluate_maxlevel(self, evaluate_from='parent'): + """ + Try to find the value of maximum decomposition level if it is not + specified explicitly. + + Parameters + ---------- + evaluate_from : {'parent', 'subnodes'} + """ + assert evaluate_from in ('parent', 'subnodes') + + if self._maxlevel is not None: + return self._maxlevel + elif self.data is not None: + return self.level + dwt_max_level( + min(self.data.shape), self.wavelet) + + if evaluate_from == 'parent': + if self.parent is not None: + return self.parent._evaluate_maxlevel(evaluate_from) + elif evaluate_from == 'subnodes': + for node_name, node in self.PARTS.items(): + if node is not None: + level = node._evaluate_maxlevel(evaluate_from) + if level is not None: + return level + return None + + def _decompose(self): + """ + See also + -------- + dwt2 : for 2D Discrete Wavelet Transform output coefficients. + """ + if self.is_empty: + coefs = {key: None for key in self.PARTS.keys()} + else: + coefs = dwtn(self.data, self.wavelet, self.mode, axes=self.axes) + + for key, data in coefs.items(): + self._create_subnode(key, data) + return (self._get_node(key) for key in self.PARTS.keys()) + + def _reconstruct(self, update): + coeffs = {key: None for key in self.PARTS.keys()} + + nnodes = 0 + for key in self.PARTS.keys(): + node = self._get_node(key) + if node is not None: + nnodes += 1 + coeffs[key] = node.reconstruct() + + if nnodes == 0: + raise ValueError( + "Tree is missing data - all subnodes of `%s` node " + "are None. Cannot reconstruct node." % self.path + ) + else: + rec = idwtn(coeffs, self.wavelet, self.mode, axes=self.axes) + if update: + self.data = rec + return rec + + +class WaveletPacket(Node): + """ + Data structure representing Wavelet Packet decomposition of signal. + + Parameters + ---------- + data : 1D ndarray + Original data (signal) + wavelet : Wavelet object or name string + Wavelet used in DWT decomposition and reconstruction + mode : str, optional + Signal extension mode for the `dwt` and `idwt` decomposition and + reconstruction functions. + maxlevel : int, optional + Maximum level of decomposition. + If None, it will be calculated based on the `wavelet` and `data` + length using `pywt.dwt_max_level`. + axis : int, optional + The axis to transform. + """ + def __init__(self, data, wavelet, mode='symmetric', maxlevel=None, + axis=-1): + super(WaveletPacket, self).__init__(None, data, "") + + if not isinstance(wavelet, Wavelet): + wavelet = Wavelet(wavelet) + self.wavelet = wavelet + self.mode = mode + self.axes = axis # self.axes is just an integer for 1D transforms + + if data is not None: + data = np.asarray(data) + if self.axes < 0: + self.axes = self.axes + data.ndim + if not 0 <= self.axes < data.ndim: + raise ValueError("Axis greater than data dimensions") + self.data_size = data.shape + if maxlevel is None: + maxlevel = dwt_max_level(data.shape[self.axes], self.wavelet) + else: + self.data_size = None + + self._maxlevel = maxlevel + + def __reduce__(self): + return (WaveletPacket, + (self.data, self.wavelet, self.mode, self.maxlevel)) + + def reconstruct(self, update=True): + """ + Reconstruct data value using coefficients from subnodes. + + Parameters + ---------- + update : bool, optional + If True (default), then data values will be replaced by + reconstruction values, also in subnodes. + """ + if self.has_any_subnode: + data = super(WaveletPacket, self).reconstruct(update) + if self.data_size is not None and (data.shape != self.data_size): + data = data[[slice(sz) for sz in self.data_size]] + if update: + self.data = data + return data + return self.data # return original data + + def get_level(self, level, order="natural", decompose=True): + """ + Returns all nodes on the specified level. + + Parameters + ---------- + level : int + Specifies decomposition `level` from which the nodes will be + collected. + order : {'natural', 'freq'}, optional + - "natural" - left to right in tree (default) + - "freq" - band ordered + decompose : bool, optional + If set then the method will try to decompose the data up + to the specified `level` (default: True). + + Notes + ----- + If nodes at the given level are missing (i.e. the tree is partially + decomposed) and `decompose` is set to False, only existing nodes + will be returned. + + Frequency order (``order="freq"``) is also known as as sequency order + and "natural" order is sometimes referred to as Paley order. A detailed + discussion of these orderings is also given in [1]_, [2]_. + + References + ---------- + ..[1] M.V. Wickerhauser. Adapted Wavelet Analysis from Theory to + Software. Wellesley. Massachusetts: A K Peters. 1994. + ..[2] D.B. Percival and A.T. Walden. Wavelet Methods for Time Series + Analysis. Cambridge University Press. 2000. + DOI:10.1017/CBO9780511841040 + """ + if order not in ["natural", "freq"]: + raise ValueError("Invalid order: {}".format(order)) + if level > self.maxlevel: + raise ValueError("The level cannot be greater than the maximum" + " decomposition level value (%d)" % self.maxlevel) + + result = [] + + def collect(node): + if node.level == level: + result.append(node) + return False + return True + + self.walk(collect, decompose=decompose) + if order == "natural": + return result + elif order == "freq": + result = dict((node.path, node) for node in result) + graycode_order = get_graycode_order(level) + return [result[path] for path in graycode_order if path in result] + else: + raise ValueError("Invalid order name - %s." % order) + + +class WaveletPacket2D(Node2D): + """ + Data structure representing 2D Wavelet Packet decomposition of signal. + + Parameters + ---------- + data : 2D ndarray + Data associated with the node. + wavelet : Wavelet object or name string + Wavelet used in DWT decomposition and reconstruction + mode : str, optional + Signal extension mode for the `dwt` and `idwt` decomposition and + reconstruction functions. + maxlevel : int + Maximum level of decomposition. + If None, it will be calculated based on the `wavelet` and `data` + length using `pywt.dwt_max_level`. + axes : 2-tuple of ints, optional + The axes that will be transformed. + """ + def __init__(self, data, wavelet, mode='smooth', maxlevel=None, + axes=(-2, -1)): + super(WaveletPacket2D, self).__init__(None, data, "") + + if not isinstance(wavelet, Wavelet): + wavelet = Wavelet(wavelet) + self.wavelet = wavelet + self.mode = mode + self.axes = tuple(axes) + if len(np.unique(self.axes)) != 2: + raise ValueError("Expected two unique axes.") + if data is not None: + data = np.asarray(data) + if data.ndim < 2: + raise ValueError( + "WaveletPacket2D requires data with 2 or more dimensions.") + self.data_size = data.shape + transform_size = [data.shape[ax] for ax in self.axes] + if maxlevel is None: + maxlevel = dwt_max_level(min(transform_size), self.wavelet) + else: + self.data_size = None + self._maxlevel = maxlevel + + def __reduce__(self): + return (WaveletPacket2D, + (self.data, self.wavelet, self.mode, self.maxlevel)) + + def reconstruct(self, update=True): + """ + Reconstruct data using coefficients from subnodes. + + Parameters + ---------- + update : bool, optional + If True (default) then the coefficients of the current node + and its subnodes will be replaced with values from reconstruction. + """ + if self.has_any_subnode: + data = super(WaveletPacket2D, self).reconstruct(update) + if self.data_size is not None and (data.shape != self.data_size): + data = data[[slice(sz) for sz in self.data_size]] + if update: + self.data = data + return data + return self.data # return original data + + def get_level(self, level, order="natural", decompose=True): + """ + Returns all nodes from specified level. + + Parameters + ---------- + level : int + Decomposition `level` from which the nodes will be + collected. + order : {'natural', 'freq'}, optional + If `natural` (default) a flat list is returned. + If `freq`, a 2d structure with rows and cols + sorted by corresponding dimension frequency of 2d + coefficient array (adapted from 1d case). + decompose : bool, optional + If set then the method will try to decompose the data up + to the specified `level` (default: True). + + Notes + ----- + Frequency order (``order="freq"``) is also known as as sequency order + and "natural" order is sometimes referred to as Paley order. A detailed + discussion of these orderings is also given in [1]_, [2]_. + + References + ---------- + ..[1] M.V. Wickerhauser. Adapted Wavelet Analysis from Theory to + Software. Wellesley. Massachusetts: A K Peters. 1994. + ..[2] D.B. Percival and A.T. Walden. Wavelet Methods for Time Series + Analysis. Cambridge University Press. 2000. + DOI:10.1017/CBO9780511841040 + """ + if order not in ["natural", "freq"]: + raise ValueError("Invalid order: {}".format(order)) + if level > self.maxlevel: + raise ValueError("The level cannot be greater than the maximum" + " decomposition level value (%d)" % self.maxlevel) + + result = [] + + def collect(node): + if node.level == level: + result.append(node) + return False + return True + + self.walk(collect, decompose=decompose) + + if order == "freq": + nodes = {} + for (row_path, col_path), node in [ + (self.expand_2d_path(node.path), node) for node in result + ]: + nodes.setdefault(row_path, {})[col_path] = node + graycode_order = get_graycode_order(level, x='l', y='h') + nodes = [nodes[path] for path in graycode_order if path in nodes] + result = [] + for row in nodes: + result.append( + [row[path] for path in graycode_order if path in row] + ) + return result + + +class WaveletPacketND(NodeND): + """ + Data structure representing ND Wavelet Packet decomposition of signal. + + Parameters + ---------- + data : ND ndarray + Data associated with the node. + wavelet : Wavelet object or name string + Wavelet used in DWT decomposition and reconstruction + mode : str, optional + Signal extension mode for the `dwt` and `idwt` decomposition and + reconstruction functions. + maxlevel : int, optional + Maximum level of decomposition. + If None, it will be calculated based on the `wavelet` and `data` + length using `pywt.dwt_max_level`. + axes : tuple of int, optional + The axes to transform. The default value of `None` corresponds to all + axes. + """ + def __init__(self, data, wavelet, mode='smooth', maxlevel=None, + axes=None): + if (data is None) and (axes is None): + # ndim is required to create a NodeND object + raise ValueError("If data is None, axes must be specified") + + # axes determines the number of transform dimensions + if axes is None: + axes = range(data.ndim) + elif np.isscalar(axes): + axes = (axes, ) + axes = tuple(axes) + if len(np.unique(axes)) != len(axes): + raise ValueError("Expected a set of unique axes.") + ndim_transform = len(axes) + + if data is not None: + data = np.asarray(data) + if data.ndim == 0: + raise ValueError("data must be at least 1D") + ndim = data.ndim + else: + ndim = len(axes) + + super(WaveletPacketND, self).__init__(None, data, "", ndim, + ndim_transform) + if not isinstance(wavelet, Wavelet): + wavelet = Wavelet(wavelet) + self.wavelet = wavelet + self.mode = mode + self.axes = axes + self.ndim_transform = ndim_transform + if data is not None: + if data.ndim < len(axes): + raise ValueError("The number of axes exceeds the number of " + "data dimensions.") + self.data_size = data.shape + transform_size = [data.shape[ax] for ax in self.axes] + if maxlevel is None: + maxlevel = dwt_max_level(min(transform_size), self.wavelet) + else: + self.data_size = None + self._maxlevel = maxlevel + + def reconstruct(self, update=True): + """ + Reconstruct data using coefficients from subnodes. + + Parameters + ---------- + update : bool, optional + If True (default) then the coefficients of the current node + and its subnodes will be replaced with values from reconstruction. + """ + if self.has_any_subnode: + data = super(WaveletPacketND, self).reconstruct(update) + if self.data_size is not None and (data.shape != self.data_size): + data = data[[slice(sz) for sz in self.data_size]] + if update: + self.data = data + return data + return self.data # return original data + + def get_level(self, level, decompose=True): + """ + Returns all nodes from specified level. + + Parameters + ---------- + level : int + Decomposition `level` from which the nodes will be + collected. + decompose : bool, optional + If set then the method will try to decompose the data up + to the specified `level` (default: True). + """ + if level > self.maxlevel: + raise ValueError("The level cannot be greater than the maximum" + " decomposition level value (%d)" % self.maxlevel) + + result = [] + + def collect(node): + if node.level == level: + result.append(node) + return False + return True + + self.walk(collect, decompose=decompose) + + return result diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/conftest.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..da8ae64553df5e9da320101ed2a82c1d1f31b409 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/conftest.py @@ -0,0 +1,6 @@ +import pytest + + +def pytest_configure(config): + config.addinivalue_line("markers", + "slow: Tests that are slow.") diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/version.py b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/version.py new file mode 100644 index 0000000000000000000000000000000000000000..7b1a7067cc53ee1ba4fd663bd50758c54fffcd5f --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/pywt/version.py @@ -0,0 +1,10 @@ + +# THIS FILE IS GENERATED FROM PYWAVELETS SETUP.PY +short_version = '1.3.0' +version = '1.3.0' +full_version = '1.3.0' +git_revision = '6dab01587a7d89a158c1a2617638f6ffa69f5d08' +release = True + +if not release: + version = full_version diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/INSTALLER b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/LICENSE b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a57cdeeca0028353177ac8a12373f0c9df3b6da1 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Phil Wang + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/METADATA b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..72a53969b2074b8f40311944144794c3e222ed71 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/METADATA @@ -0,0 +1,21 @@ +Metadata-Version: 2.1 +Name: rotary-embedding-torch +Version: 0.1.5 +Summary: Rotary Embedding - Pytorch +Home-page: https://github.com/lucidrains/rotary-embedding-torch +Author: Phil Wang +Author-email: lucidrains@gmail.com +License: MIT +Keywords: artificial intelligence,deep learning,positional embedding +Platform: UNKNOWN +Classifier: Development Status :: 4 - Beta +Classifier: Intended Audience :: Developers +Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence +Classifier: License :: OSI Approved :: MIT License +Classifier: Programming Language :: Python :: 3.6 +License-File: LICENSE +Requires-Dist: einops (>=0.3) +Requires-Dist: torch (>=1.6) + +UNKNOWN + diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/RECORD b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..2fc384132aead9eab0b289ca27bb78c6c04ab095 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/RECORD @@ -0,0 +1,11 @@ +rotary_embedding_torch-0.1.5.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +rotary_embedding_torch-0.1.5.dist-info/LICENSE,sha256=_nRlQFj-K6BpgI2_Nt79biB7r4hZ82NmpqPOrlqm7MU,1066 +rotary_embedding_torch-0.1.5.dist-info/METADATA,sha256=-_3JpNhvBfzQU3Y_9gRsRWWxLpVbin_RfMTZZBodklw,669 +rotary_embedding_torch-0.1.5.dist-info/RECORD,, +rotary_embedding_torch-0.1.5.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +rotary_embedding_torch-0.1.5.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92 +rotary_embedding_torch-0.1.5.dist-info/top_level.txt,sha256=fKu2Ga5Sao0xFoX8j9knsSXjBf28oXurUAYtiYMIl-o,23 +rotary_embedding_torch/__init__.py,sha256=cpQC_70hX2AX1Y-LRBUWI1WRiYJ0Bb5VLNERNQNJHXM,127 +rotary_embedding_torch/__pycache__/__init__.cpython-38.pyc,, +rotary_embedding_torch/__pycache__/rotary_embedding_torch.cpython-38.pyc,, +rotary_embedding_torch/rotary_embedding_torch.py,sha256=9sJMT7HuoLevc5TTNxN_5e8pQMkL9uV-TZA_CVZNF-c,3896 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/REQUESTED b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/WHEEL b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..becc9a66ea739ba941d48a749e248761cc6e658a --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.37.1) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/top_level.txt b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..b93a8cbbfe60d5b9929e9252aa2a475ab3211636 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/rotary_embedding_torch-0.1.5.dist-info/top_level.txt @@ -0,0 +1 @@ +rotary_embedding_torch diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/INSTALLER b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/LICENSE b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..1bec23eaf1dd562ae3d3216420b1b1bbfbd39cbc --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/LICENSE @@ -0,0 +1,25 @@ +BSD 2-Clause License + +Copyright (c) 2017 Facebook Inc. (Soumith Chintala), +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/METADATA b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..5c7d35a9bf59cc0061e43dc844f8b2a62a6ff59d --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/METADATA @@ -0,0 +1,28 @@ +Metadata-Version: 2.1 +Name: torchaudio +Version: 0.12.1+cu113 +Summary: An audio package for PyTorch +Home-page: https://github.com/pytorch/audio +Author: Soumith Chintala, David Pollack, Sean Naren, Peter Goldsborough +Author-email: soumith@pytorch.org +License: UNKNOWN +Platform: UNKNOWN +Classifier: Environment :: Plugins +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Science/Research +Classifier: License :: OSI Approved :: BSD License +Classifier: Operating System :: MacOS :: MacOS X +Classifier: Operating System :: Microsoft :: Windows +Classifier: Operating System :: POSIX +Classifier: Programming Language :: C++ +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Topic :: Multimedia :: Sound/Audio +Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence +Requires-Dist: torch (==1.12.1) + +UNKNOWN + + diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/RECORD b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..874379c043dbbde220b0467e2e9223f81f52814a --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/RECORD @@ -0,0 +1,159 @@ +torchaudio-0.12.1+cu113.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +torchaudio-0.12.1+cu113.dist-info/LICENSE,sha256=k6WIYahYzBCOa2uDPgjnbosqZjOeSoAHyKWowf-cQNY,1338 +torchaudio-0.12.1+cu113.dist-info/METADATA,sha256=as9kVUCnbbAOGLPsakPvKtoGPBDv_4ZdHDlEBvM4Pgc,1027 +torchaudio-0.12.1+cu113.dist-info/RECORD,, +torchaudio-0.12.1+cu113.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torchaudio-0.12.1+cu113.dist-info/WHEEL,sha256=TpFVeXF_cAlV118WSIPWtjqW7nPvzoOw-49FmS3fDKQ,103 +torchaudio-0.12.1+cu113.dist-info/top_level.txt,sha256=mPKWMIRWWW2JwbJN6wRckeN1gpbjhifapAF0Z9t7SMo,11 +torchaudio/__init__.py,sha256=d-y1As3Kn_fwPkEN-EF2nMGZnvC7EODzkLf4M50zvd8,635 +torchaudio/__pycache__/__init__.cpython-38.pyc,, +torchaudio/__pycache__/_extension.cpython-38.pyc,, +torchaudio/__pycache__/kaldi_io.cpython-38.pyc,, +torchaudio/__pycache__/version.cpython-38.pyc,, +torchaudio/_extension.py,sha256=-B_lqR_cN9lh84Y9ilRyA2SyEwHl0Z_OVRalNUrtn-k,3563 +torchaudio/_internal/__init__.py,sha256=O4YXy3MQbnE-RanX_jtc9TOuTaImyKncIIkSV0PXjS8,145 +torchaudio/_internal/__pycache__/__init__.cpython-38.pyc,, +torchaudio/_internal/__pycache__/module_utils.cpython-38.pyc,, +torchaudio/_internal/module_utils.py,sha256=Rk5wLx59OQzS7B0olUfa-2nPNYfXCqCwiXV8EAvVezM,3897 +torchaudio/_torchaudio.so,sha256=aQ5Et_K_OjnYgxbR6jOJykz1I_0jS4b-ippPFnvHO20,2520912 +torchaudio/_torchaudio_decoder.so,sha256=z7jGIvWZ0qKgAteYwW83Utg76s4FzjmX_kkqD9XSFpM,570584 +torchaudio/_torchaudio_ffmpeg.so,sha256=gqcmAamUuWqMR2olIyUCjQEt2aoBG_tJVPl5e3QM2t0,219928 +torchaudio/backend/__init__.py,sha256=99V5iMl7efxxos9ZdjshSW_4HN-LmY8vazIfk7MYU-I,142 +torchaudio/backend/__pycache__/__init__.cpython-38.pyc,, +torchaudio/backend/__pycache__/common.cpython-38.pyc,, +torchaudio/backend/__pycache__/no_backend.cpython-38.pyc,, +torchaudio/backend/__pycache__/soundfile_backend.cpython-38.pyc,, +torchaudio/backend/__pycache__/sox_io_backend.cpython-38.pyc,, +torchaudio/backend/__pycache__/utils.cpython-38.pyc,, +torchaudio/backend/common.py,sha256=kYIenjKIUaQNzp37JRPjiQAMGVLsDlxmCF2Pxrz-V-U,1896 +torchaudio/backend/no_backend.py,sha256=42bQbF09OSUscMC43OChMOBvfP3ZxY9D6dkKRr77i2A,711 +torchaudio/backend/soundfile_backend.py,sha256=NwvUoe6TfvtlHNOoz57ouj5Z1XCO1AuuctgppSyNrpY,16666 +torchaudio/backend/sox_io_backend.py,sha256=0Fs0ellg14P6BE_Ie3gJKxDAv5B75YF9U0iQ1qXjjmU,16337 +torchaudio/backend/utils.py,sha256=qf5YQyQQWIjDMhisfxn_Z51bvj6w6f_8J7sLnDQSQtU,2303 +torchaudio/compliance/__init__.py,sha256=hhNObUS0c-fS-VMudM7zl3-CvupvCDmESlikntSMn5g,48 +torchaudio/compliance/__pycache__/__init__.cpython-38.pyc,, +torchaudio/compliance/__pycache__/kaldi.cpython-38.pyc,, +torchaudio/compliance/kaldi.py,sha256=Fh5NcTtGdLrza-N3y8TflCfE6OWocnaZYjzSIrhAysc,36810 +torchaudio/datasets/__init__.py,sha256=1n75rvl6pbX4IBACF5WxA7jBRiPYvN4gBL3d-YsttzQ,757 +torchaudio/datasets/__pycache__/__init__.cpython-38.pyc,, +torchaudio/datasets/__pycache__/cmuarctic.cpython-38.pyc,, +torchaudio/datasets/__pycache__/cmudict.cpython-38.pyc,, +torchaudio/datasets/__pycache__/commonvoice.cpython-38.pyc,, +torchaudio/datasets/__pycache__/dr_vctk.cpython-38.pyc,, +torchaudio/datasets/__pycache__/gtzan.cpython-38.pyc,, +torchaudio/datasets/__pycache__/librilight_limited.cpython-38.pyc,, +torchaudio/datasets/__pycache__/librimix.cpython-38.pyc,, +torchaudio/datasets/__pycache__/librispeech.cpython-38.pyc,, +torchaudio/datasets/__pycache__/libritts.cpython-38.pyc,, +torchaudio/datasets/__pycache__/ljspeech.cpython-38.pyc,, +torchaudio/datasets/__pycache__/quesst14.cpython-38.pyc,, +torchaudio/datasets/__pycache__/speechcommands.cpython-38.pyc,, +torchaudio/datasets/__pycache__/tedlium.cpython-38.pyc,, +torchaudio/datasets/__pycache__/utils.cpython-38.pyc,, +torchaudio/datasets/__pycache__/vctk.cpython-38.pyc,, +torchaudio/datasets/__pycache__/yesno.cpython-38.pyc,, +torchaudio/datasets/cmuarctic.py,sha256=_VhvbYzZ6YJZyaGT_PLPfleT0jV3ZgjHUo_SVfEZhKc,6979 +torchaudio/datasets/cmudict.py,sha256=sLkJ8ZjwRF8cYA9xbUTL4-EjfBZZAGiaRgfyAcErmTg,6187 +torchaudio/datasets/commonvoice.py,sha256=sRP1S2IXgZ32EfSAVIsKBUxA-I6SX3PXR34VBVtW3Dg,2479 +torchaudio/datasets/dr_vctk.py,sha256=PomDY-mB-2lVwARyqgmXvTQRCT2w2ESMNl7zDVhezJg,4148 +torchaudio/datasets/gtzan.py,sha256=tQbgFhJQ_Ziy2WpeH4Bkj4qPQ8gsxUgT4ts4XSlg2_Q,24092 +torchaudio/datasets/librilight_limited.py,sha256=JyUXFcWjOyvYJkbL70CHHb3F9yEsWoKGwm88xpI3MGc,3571 +torchaudio/datasets/librimix.py,sha256=NpOGv3GYG6_rFCGDCi6b1u_rrhkpQz-t04K1j2CKT3s,3493 +torchaudio/datasets/librispeech.py,sha256=ff6RVBWY2bsS6aChW5ZGwnkyjeYm9gQ5ZmIWA1-Fj74,5240 +torchaudio/datasets/libritts.py,sha256=WEIQFP6yrFKnCkoAiq8vKl70t6iZL8E3PJi80Yd59Io,5688 +torchaudio/datasets/ljspeech.py,sha256=sCSbgOLfsRvQJYxuuErQ7topI5SyxgkbZ3xh2RYnVsI,3388 +torchaudio/datasets/quesst14.py,sha256=zBHvFtEvFpNnZ32UVJ1Kv7cfKXHOKkI4Qxmyzt2isWM,3705 +torchaudio/datasets/speechcommands.py,sha256=Bw22eIX_C3gt8dY1cfTr17_eO_U560pUMLj1wCCw8_w,6589 +torchaudio/datasets/tedlium.py,sha256=aWW_LDJC0HDkPRWls9e0HdRE4x_ziYN9ZnWNO_fRGfY,8514 +torchaudio/datasets/utils.py,sha256=RizrF-4mcxuMS5mZW-EgFQC6LI3nbF7Xebi3k8ZSEH8,6782 +torchaudio/datasets/vctk.py,sha256=xF060Zv5eqYQ_Iw-laWiPAsrb-5NDrC0BRA172BD_O0,5560 +torchaudio/datasets/yesno.py,sha256=9Wpia19JvCH2hSp9cD20YK1FhgbJ_TJxfQkUqLWBPNc,2935 +torchaudio/functional/__init__.py,sha256=Whh616s6Wa56FQTQo39MpJ7TAVXm4SMEIP9B81mb_7A,2022 +torchaudio/functional/__pycache__/__init__.cpython-38.pyc,, +torchaudio/functional/__pycache__/filtering.cpython-38.pyc,, +torchaudio/functional/__pycache__/functional.cpython-38.pyc,, +torchaudio/functional/filtering.py,sha256=gSXDjqVVCONMZHJPi5W-IBvt_yVhtw7BoVsvvKmJx0M,60725 +torchaudio/functional/functional.py,sha256=FlTnANEk97JjClh0i164QbQ0-xblQ1CrWvMOWZ9t_YA,80586 +torchaudio/io/__init__.py,sha256=suYH53ja9UhZPTHfEbqVNBw3lQQwIYH0jkSPhx7bt2k,593 +torchaudio/io/__pycache__/__init__.cpython-38.pyc,, +torchaudio/io/__pycache__/_compat.cpython-38.pyc,, +torchaudio/io/__pycache__/_stream_reader.cpython-38.pyc,, +torchaudio/io/_compat.py,sha256=8R8_BcxSL1DH0HV4y8cDOyK_ogvS8AR70_JVC0z7EqA,3433 +torchaudio/io/_stream_reader.py,sha256=84LfwA4g015SyuLnpWLI6t87xW0PctabH20xS03mCcI,24583 +torchaudio/kaldi_io.py,sha256=XbCiGz1mrYzYQ1uAVnvnHBm2HXz3v-inqjtOEOF-I0I,4995 +torchaudio/lib/libtorchaudio.so,sha256=0qdNvcgX_mKbmPHidXaEAmR0-Kwci8VUnCbfE6JFfas,6385376 +torchaudio/lib/libtorchaudio_decoder.so,sha256=D8y-4wBuKspPSC1PpnWxs7fYSbOWf_YQO79s9yT8ils,1253752 +torchaudio/lib/libtorchaudio_ffmpeg.so,sha256=_0d9rC07pE9A8-rSUawwq69Xk6soPuOBDL8nncGuoqA,412304 +torchaudio/models/__init__.py,sha256=DjA3yvXm0A_u_cYP80Lk4DI77uexqVYWuF5iC8RzYxg,1223 +torchaudio/models/__pycache__/__init__.cpython-38.pyc,, +torchaudio/models/__pycache__/conformer.cpython-38.pyc,, +torchaudio/models/__pycache__/conv_tasnet.cpython-38.pyc,, +torchaudio/models/__pycache__/deepspeech.cpython-38.pyc,, +torchaudio/models/__pycache__/emformer.cpython-38.pyc,, +torchaudio/models/__pycache__/rnnt.cpython-38.pyc,, +torchaudio/models/__pycache__/rnnt_decoder.cpython-38.pyc,, +torchaudio/models/__pycache__/tacotron2.cpython-38.pyc,, +torchaudio/models/__pycache__/wav2letter.cpython-38.pyc,, +torchaudio/models/__pycache__/wavernn.cpython-38.pyc,, +torchaudio/models/conformer.py,sha256=vmgckeUvmMzIkKaWW3UzZuJg63a1y9_WJcSf7MfZQHM,10063 +torchaudio/models/conv_tasnet.py,sha256=yy6lt2cqftX5QZTSs61ej4QobMJu26Fi5gvcnzxJ8xA,11648 +torchaudio/models/decoder/__init__.py,sha256=e_Cy9VaAusVLqnOyZrFCMzw_FkoLTtF_psumSOLcMMs,925 +torchaudio/models/decoder/__pycache__/__init__.cpython-38.pyc,, +torchaudio/models/decoder/__pycache__/_ctc_decoder.cpython-38.pyc,, +torchaudio/models/decoder/_ctc_decoder.py,sha256=WaCiGZTo9SJH7AYhjqnYKseRXPBTgE4r5TV13QP6FJY,12263 +torchaudio/models/deepspeech.py,sha256=HQ3dIsXaG73oYpuyfHO7Ur5jgyV-5_kJRS0maEPcBxA,2754 +torchaudio/models/emformer.py,sha256=nz-MeERv8SCX4Ky9bxaoMzSLDW1Do6FQRxKThst7RCM,37410 +torchaudio/models/rnnt.py,sha256=-ErgarCv5aEbQzv6iZWvjos9JntuSpB6tB_Cz2YpzbU,35428 +torchaudio/models/rnnt_decoder.py,sha256=l2NbmP8olv-7XowGcqw-5NG0_y6ZlxkMbqJ7vX9nkVQ,12793 +torchaudio/models/tacotron2.py,sha256=3A1qcax8MqvcmURnju9jNzYYhhg6bUY4k9Z_OAfC84E,45785 +torchaudio/models/wav2letter.py,sha256=K83XOonZK9nJhSbf7Ly-PiczOOTZNSGj2WwvotUOrvc,3256 +torchaudio/models/wav2vec2/__init__.py,sha256=kOpGoBRi6QKl-TiXrafRHHcTe5W8wOUoQIKvBpptsXI,679 +torchaudio/models/wav2vec2/__pycache__/__init__.cpython-38.pyc,, +torchaudio/models/wav2vec2/__pycache__/components.cpython-38.pyc,, +torchaudio/models/wav2vec2/__pycache__/model.cpython-38.pyc,, +torchaudio/models/wav2vec2/components.py,sha256=DQP0GTPjLXOZH5khWXoM24u1KJJ6M5XjEm66BPc5MGg,41535 +torchaudio/models/wav2vec2/model.py,sha256=mXB6V4n8lMi3vtyaFQQqCCGL8npXI1dcsI5siGxHyNA,50042 +torchaudio/models/wav2vec2/utils/__init__.py,sha256=qmMbz4HAN5kEEyl4cSGm_JQZI47beyh4witydPC_qns,181 +torchaudio/models/wav2vec2/utils/__pycache__/__init__.cpython-38.pyc,, +torchaudio/models/wav2vec2/utils/__pycache__/import_fairseq.cpython-38.pyc,, +torchaudio/models/wav2vec2/utils/__pycache__/import_huggingface.cpython-38.pyc,, +torchaudio/models/wav2vec2/utils/import_fairseq.py,sha256=mTsb6HX5iZTvXRvmDCzG5ingDY-2mvJk8SIidt_N410,9359 +torchaudio/models/wav2vec2/utils/import_huggingface.py,sha256=lmd7HUA417dCjQEhWM7rojmS7ukc49-4nV9FgvmxkW0,3089 +torchaudio/models/wavernn.py,sha256=RI9Weq9ENKCfSNSMs59MlSC4DkDMOzF85xyI9nB2-qg,15117 +torchaudio/pipelines/__init__.py,sha256=E7DdYnx5CThsORoE_lulT7yzK0z1IsrV4aDF6bThUyo,1928 +torchaudio/pipelines/__pycache__/__init__.cpython-38.pyc,, +torchaudio/pipelines/__pycache__/rnnt_pipeline.cpython-38.pyc,, +torchaudio/pipelines/_tts/__init__.py,sha256=PP7l8XzVURqelwuMJFgfOCv4fvzZunDiy90ZQlRkv7g,426 +torchaudio/pipelines/_tts/__pycache__/__init__.cpython-38.pyc,, +torchaudio/pipelines/_tts/__pycache__/impl.cpython-38.pyc,, +torchaudio/pipelines/_tts/__pycache__/interface.cpython-38.pyc,, +torchaudio/pipelines/_tts/__pycache__/utils.cpython-38.pyc,, +torchaudio/pipelines/_tts/impl.py,sha256=pi4XNKZhyr-2VQ-BfkDsf0tWX5BxnmNGIer4Uo9yoRw,15678 +torchaudio/pipelines/_tts/interface.py,sha256=Je5zgShZN-BzSYK2-Xq1yQNzXf7M3KQaVRMyDh3vgLE,11180 +torchaudio/pipelines/_tts/utils.py,sha256=0rLyoFWS78n5jn9AC99pgIwAjaXSw-MVbj_pjSaOHiM,4616 +torchaudio/pipelines/_wav2vec2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torchaudio/pipelines/_wav2vec2/__pycache__/__init__.cpython-38.pyc,, +torchaudio/pipelines/_wav2vec2/__pycache__/impl.cpython-38.pyc,, +torchaudio/pipelines/_wav2vec2/__pycache__/utils.cpython-38.pyc,, +torchaudio/pipelines/_wav2vec2/impl.py,sha256=jSzTCNTeFdZUuAwbigy3hdgenUl7Fzw0Td_Rqk8KBFQ,46847 +torchaudio/pipelines/_wav2vec2/utils.py,sha256=4LnmKOKS3eZJ8Wwv2n6GPpZgQZhVejFBgca1ZhUyPVU,2868 +torchaudio/pipelines/rnnt_pipeline.py,sha256=fxnFevcVVu7OLgO9BCbK14lS8f8j-cnrYMHF9Wzqdbk,13627 +torchaudio/sox_effects/__init__.py,sha256=az_2dARAVYerSUePPqXUNJMwu3bXKy-vkI4QRmFTHX4,467 +torchaudio/sox_effects/__pycache__/__init__.cpython-38.pyc,, +torchaudio/sox_effects/__pycache__/sox_effects.cpython-38.pyc,, +torchaudio/sox_effects/sox_effects.py,sha256=nnV5Ks_SlIZQw66Aep73zljx4fTCUecl2m7aAmbKo8A,11795 +torchaudio/transforms/__init__.py,sha256=HDkM0bQaKmR70wf-nMcNcm-ao--F7EIko2gcTBQGg8U,966 +torchaudio/transforms/__pycache__/__init__.cpython-38.pyc,, +torchaudio/transforms/__pycache__/_multi_channel.cpython-38.pyc,, +torchaudio/transforms/__pycache__/_transforms.cpython-38.pyc,, +torchaudio/transforms/_multi_channel.py,sha256=seWCcdMKTUI61t4EQK-waiuuqrc9gUg7HnX0wd6kiyQ,22199 +torchaudio/transforms/_transforms.py,sha256=a7R5TkUal6VVufq7UOyt3hfl7fA4gNF12ZOEyV59B4Y,68873 +torchaudio/utils/__init__.py,sha256=wnFgSS_s3ET97wKyvz8QcWI_mn8OnJbMTrKnV0ZwTPE,276 +torchaudio/utils/__pycache__/__init__.cpython-38.pyc,, +torchaudio/utils/__pycache__/download.cpython-38.pyc,, +torchaudio/utils/__pycache__/ffmpeg_utils.cpython-38.pyc,, +torchaudio/utils/__pycache__/sox_utils.cpython-38.pyc,, +torchaudio/utils/download.py,sha256=o2AMbgpVtpVyoVGahKNMjFULUXk9UruQBWlWaeLOrOI,2839 +torchaudio/utils/ffmpeg_utils.py,sha256=KlG3oYTEtBJRAZpt1JSHZyZjKCPJxyi4_zI5_QdvNZM,1707 +torchaudio/utils/sox_utils.py,sha256=gJSPQKTDlcFkyetFNyQH7wPKw0Udt9hHnZq8Z7iwucs,2647 +torchaudio/version.py,sha256=WTgmT7pIYlqKbhSRQ0o5PD3hSwMKP904OmP3mDmd8P8,86 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/REQUESTED b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/WHEEL b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..d193dea988d97c2f7f7bf3c4fc196496d361cd4d --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.34.2) +Root-Is-Purelib: false +Tag: cp38-cp38-linux_x86_64 + diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/top_level.txt b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..3daffcdd3d8f90b1f600c41c0f21cc75922902e8 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/top_level.txt @@ -0,0 +1 @@ +torchaudio diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/typing_extensions-4.2.0.dist-info/INSTALLER b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/typing_extensions-4.2.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/typing_extensions-4.2.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/typing_extensions-4.2.0.dist-info/LICENSE b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/typing_extensions-4.2.0.dist-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..583f9f6e6175f891a0ebd56dfe41ad9411b233b9 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/typing_extensions-4.2.0.dist-info/LICENSE @@ -0,0 +1,254 @@ +A. HISTORY OF THE SOFTWARE +========================== + +Python was created in the early 1990s by Guido van Rossum at Stichting +Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands +as a successor of a language called ABC. Guido remains Python's +principal author, although it includes many contributions from others. + +In 1995, Guido continued his work on Python at the Corporation for +National Research Initiatives (CNRI, see http://www.cnri.reston.va.us) +in Reston, Virginia where he released several versions of the +software. + +In May 2000, Guido and the Python core development team moved to +BeOpen.com to form the BeOpen PythonLabs team. In October of the same +year, the PythonLabs team moved to Digital Creations (now Zope +Corporation, see http://www.zope.com). In 2001, the Python Software +Foundation (PSF, see http://www.python.org/psf/) was formed, a +non-profit organization created specifically to own Python-related +Intellectual Property. Zope Corporation is a sponsoring member of +the PSF. + +All Python releases are Open Source (see http://www.opensource.org for +the Open Source Definition). Historically, most, but not all, Python +releases have also been GPL-compatible; the table below summarizes +the various releases. + + Release Derived Year Owner GPL- + from compatible? (1) + + 0.9.0 thru 1.2 1991-1995 CWI yes + 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes + 1.6 1.5.2 2000 CNRI no + 2.0 1.6 2000 BeOpen.com no + 1.6.1 1.6 2001 CNRI yes (2) + 2.1 2.0+1.6.1 2001 PSF no + 2.0.1 2.0+1.6.1 2001 PSF yes + 2.1.1 2.1+2.0.1 2001 PSF yes + 2.1.2 2.1.1 2002 PSF yes + 2.1.3 2.1.2 2002 PSF yes + 2.2 and above 2.1.1 2001-now PSF yes + +Footnotes: + +(1) GPL-compatible doesn't mean that we're distributing Python under + the GPL. All Python licenses, unlike the GPL, let you distribute + a modified version without making your changes open source. The + GPL-compatible licenses make it possible to combine Python with + other software that is released under the GPL; the others don't. + +(2) According to Richard Stallman, 1.6.1 is not GPL-compatible, + because its license has a choice of law clause. According to + CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1 + is "not incompatible" with the GPL. + +Thanks to the many outside volunteers who have worked under Guido's +direction to make these releases possible. + + +B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON +=============================================================== + +PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 +-------------------------------------------- + +1. This LICENSE AGREEMENT is between the Python Software Foundation +("PSF"), and the Individual or Organization ("Licensee") accessing and +otherwise using this software ("Python") in source or binary form and +its associated documentation. + +2. Subject to the terms and conditions of this License Agreement, PSF hereby +grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, +analyze, test, perform and/or display publicly, prepare derivative works, +distribute, and otherwise use Python alone or in any derivative version, +provided, however, that PSF's License Agreement and PSF's notice of copyright, +i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +2011, 2012, 2013, 2014 Python Software Foundation; All Rights Reserved" are +retained in Python alone or in any derivative version prepared by Licensee. + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python. + +4. PSF is making Python available to Licensee on an "AS IS" +basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. Nothing in this License Agreement shall be deemed to create any +relationship of agency, partnership, or joint venture between PSF and +Licensee. This License Agreement does not grant permission to use PSF +trademarks or trade name in a trademark sense to endorse or promote +products or services of Licensee, or any third party. + +8. By copying, installing or otherwise using Python, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + + +BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0 +------------------------------------------- + +BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 + +1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an +office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the +Individual or Organization ("Licensee") accessing and otherwise using +this software in source or binary form and its associated +documentation ("the Software"). + +2. Subject to the terms and conditions of this BeOpen Python License +Agreement, BeOpen hereby grants Licensee a non-exclusive, +royalty-free, world-wide license to reproduce, analyze, test, perform +and/or display publicly, prepare derivative works, distribute, and +otherwise use the Software alone or in any derivative version, +provided, however, that the BeOpen Python License is retained in the +Software, alone or in any derivative version prepared by Licensee. + +3. BeOpen is making the Software available to Licensee on an "AS IS" +basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE +SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS +AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY +DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +5. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +6. This License Agreement shall be governed by and interpreted in all +respects by the law of the State of California, excluding conflict of +law provisions. Nothing in this License Agreement shall be deemed to +create any relationship of agency, partnership, or joint venture +between BeOpen and Licensee. This License Agreement does not grant +permission to use BeOpen trademarks or trade names in a trademark +sense to endorse or promote products or services of Licensee, or any +third party. As an exception, the "BeOpen Python" logos available at +http://www.pythonlabs.com/logos.html may be used according to the +permissions granted on that web page. + +7. By copying, installing or otherwise using the software, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + + +CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1 +--------------------------------------- + +1. This LICENSE AGREEMENT is between the Corporation for National +Research Initiatives, having an office at 1895 Preston White Drive, +Reston, VA 20191 ("CNRI"), and the Individual or Organization +("Licensee") accessing and otherwise using Python 1.6.1 software in +source or binary form and its associated documentation. + +2. Subject to the terms and conditions of this License Agreement, CNRI +hereby grants Licensee a nonexclusive, royalty-free, world-wide +license to reproduce, analyze, test, perform and/or display publicly, +prepare derivative works, distribute, and otherwise use Python 1.6.1 +alone or in any derivative version, provided, however, that CNRI's +License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) +1995-2001 Corporation for National Research Initiatives; All Rights +Reserved" are retained in Python 1.6.1 alone or in any derivative +version prepared by Licensee. Alternately, in lieu of CNRI's License +Agreement, Licensee may substitute the following text (omitting the +quotes): "Python 1.6.1 is made available subject to the terms and +conditions in CNRI's License Agreement. This Agreement together with +Python 1.6.1 may be located on the Internet using the following +unique, persistent identifier (known as a handle): 1895.22/1013. This +Agreement may also be obtained from a proxy server on the Internet +using the following URL: http://hdl.handle.net/1895.22/1013". + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python 1.6.1 or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python 1.6.1. + +4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" +basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. This License Agreement shall be governed by the federal +intellectual property law of the United States, including without +limitation the federal copyright law, and, to the extent such +U.S. federal law does not apply, by the law of the Commonwealth of +Virginia, excluding Virginia's conflict of law provisions. +Notwithstanding the foregoing, with regard to derivative works based +on Python 1.6.1 that incorporate non-separable material that was +previously distributed under the GNU General Public License (GPL), the +law of the Commonwealth of Virginia shall govern this License +Agreement only as to issues arising under or with respect to +Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this +License Agreement shall be deemed to create any relationship of +agency, partnership, or joint venture between CNRI and Licensee. This +License Agreement does not grant permission to use CNRI trademarks or +trade name in a trademark sense to endorse or promote products or +services of Licensee, or any third party. + +8. By clicking on the "ACCEPT" button where indicated, or by copying, +installing or otherwise using Python 1.6.1, Licensee agrees to be +bound by the terms and conditions of this License Agreement. + + ACCEPT + + +CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2 +-------------------------------------------------- + +Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, +The Netherlands. All rights reserved. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Stichting Mathematisch +Centrum or CWI not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO +THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE +FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/typing_extensions-4.2.0.dist-info/METADATA b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/typing_extensions-4.2.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..cd53468587e0d725aaf9dcf945d975a6ac0ca410 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/typing_extensions-4.2.0.dist-info/METADATA @@ -0,0 +1,176 @@ +Metadata-Version: 2.1 +Name: typing_extensions +Version: 4.2.0 +Summary: Backported and Experimental Type Hints for Python 3.7+ +Keywords: annotations,backport,checker,checking,function,hinting,hints,type,typechecking,typehinting,typehints,typing +Author-email: "Guido van Rossum, Jukka Lehtosalo, Łukasz Langa, Michael Lee" +Requires-Python: >=3.7 +Description-Content-Type: text/x-rst +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Console +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Python Software Foundation License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Topic :: Software Development +Project-URL: Home, https://github.com/python/typing/blob/master/typing_extensions/README.rst + +================= +Typing Extensions +================= + +.. image:: https://badges.gitter.im/python/typing.svg + :alt: Chat at https://gitter.im/python/typing + :target: https://gitter.im/python/typing?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge + +Overview +======== + +The ``typing_extensions`` module serves two related purposes: + +- Enable use of new type system features on older Python versions. For example, + ``typing.TypeGuard`` is new in Python 3.10, but ``typing_extensions`` allows + users on Python 3.6 through 3.9 to use it too. +- Enable experimentation with new type system PEPs before they are accepted and + added to the ``typing`` module. + +New features may be added to ``typing_extensions`` as soon as they are specified +in a PEP that has been added to the `python/peps `_ +repository. If the PEP is accepted, the feature will then be added to ``typing`` +for the next CPython release. No typing PEP has been rejected so far, so we +haven't yet figured out how to deal with that possibility. + +Starting with version 4.0.0, ``typing_extensions`` uses +`Semantic Versioning `_. The +major version is incremented for all backwards-incompatible changes. +Therefore, it's safe to depend +on ``typing_extensions`` like this: ``typing_extensions >=x.y, <(x+1)``, +where ``x.y`` is the first version that includes all features you need. + +``typing_extensions`` supports Python versions 3.7 and higher. In the future, +support for older Python versions will be dropped some time after that version +reaches end of life. + +Included items +============== + +This module currently contains the following: + +- Experimental features + + - ``@dataclass_transform()`` (see PEP 681) + +- In ``typing`` since Python 3.11 + + - ``assert_never`` + - ``assert_type`` + - ``clear_overloads`` + - ``get_overloads`` + - ``LiteralString`` (see PEP 675) + - ``Never`` + - ``NotRequired`` (see PEP 655) + - ``reveal_type`` + - ``Required`` (see PEP 655) + - ``Self`` (see PEP 673) + - ``TypeVarTuple`` (see PEP 646) + - ``Unpack`` (see PEP 646) + +- In ``typing`` since Python 3.10 + + - ``Concatenate`` (see PEP 612) + - ``ParamSpec`` (see PEP 612) + - ``ParamSpecArgs`` (see PEP 612) + - ``ParamSpecKwargs`` (see PEP 612) + - ``TypeAlias`` (see PEP 613) + - ``TypeGuard`` (see PEP 647) + - ``is_typeddict`` + +- In ``typing`` since Python 3.9 + + - ``Annotated`` (see PEP 593) + +- In ``typing`` since Python 3.8 + + - ``final`` (see PEP 591) + - ``Final`` (see PEP 591) + - ``Literal`` (see PEP 586) + - ``Protocol`` (see PEP 544) + - ``runtime_checkable`` (see PEP 544) + - ``TypedDict`` (see PEP 589) + - ``get_origin`` (``typing_extensions`` provides this function only in Python 3.7+) + - ``get_args`` (``typing_extensions`` provides this function only in Python 3.7+) + +- In ``typing`` since Python 3.7 + + - ``OrderedDict`` + +- In ``typing`` since Python 3.5 or 3.6 (see `the typing documentation + `_ for details) + + - ``AsyncContextManager`` + - ``AsyncGenerator`` + - ``AsyncIterable`` + - ``AsyncIterator`` + - ``Awaitable`` + - ``ChainMap`` + - ``ClassVar`` (see PEP 526) + - ``ContextManager`` + - ``Coroutine`` + - ``Counter`` + - ``DefaultDict`` + - ``Deque`` + - ``NewType`` + - ``NoReturn`` + - ``overload`` + - ``Text`` + - ``Type`` + - ``TYPE_CHECKING`` + - ``get_type_hints`` + +Other Notes and Limitations +=========================== + +Certain objects were changed after they were added to ``typing``, and +``typing_extensions`` provides a backport even on newer Python versions: + +- ``TypedDict`` does not store runtime information + about which (if any) keys are non-required in Python 3.8, and does not + honor the "total" keyword with old-style ``TypedDict()`` in Python + 3.9.0 and 3.9.1. +- ``get_origin`` and ``get_args`` lack support for ``Annotated`` in + Python 3.8 and lack support for ``ParamSpecArgs`` and ``ParamSpecKwargs`` + in 3.9. +- ``@final`` was changed in Python 3.11 to set the ``.__final__`` attribute. +- ``@overload`` was changed in Python 3.11 to make function overloads + introspectable at runtime. In order to access overloads with + ``typing_extensions.get_overloads()``, you must use + ``@typing_extensions.overload``. + +There are a few types whose interface was modified between different +versions of typing. For example, ``typing.Sequence`` was modified to +subclass ``typing.Reversible`` as of Python 3.5.3. + +These changes are _not_ backported to prevent subtle compatibility +issues when mixing the differing implementations of modified classes. + +Certain types have incorrect runtime behavior due to limitations of older +versions of the typing module: + +- ``ParamSpec`` and ``Concatenate`` will not work with ``get_args`` and + ``get_origin``. Certain PEP 612 special cases in user-defined + ``Generic``\ s are also not available. + +These types are only guaranteed to work for static type checking. + +Running tests +============= + +To run tests, navigate into the appropriate source directory and run +``test_typing_extensions.py``. + diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/typing_extensions-4.2.0.dist-info/RECORD b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/typing_extensions-4.2.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..a00eaed1244b52a18a710d4f2f43b5ecc60e0746 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/typing_extensions-4.2.0.dist-info/RECORD @@ -0,0 +1,8 @@ +__pycache__/typing_extensions.cpython-38.pyc,, +typing_extensions-4.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +typing_extensions-4.2.0.dist-info/LICENSE,sha256=_xfOlOECAk3raHc-scx0ynbaTmWPNzUx8Kwi1oprsa0,12755 +typing_extensions-4.2.0.dist-info/METADATA,sha256=3-7fzBwNeYQUcfs7GG2FdHJW4U1CW1CvJRT-LPDC3tk,6211 +typing_extensions-4.2.0.dist-info/RECORD,, +typing_extensions-4.2.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +typing_extensions-4.2.0.dist-info/WHEEL,sha256=4TfKIB_xu-04bc2iKz6_zFt-gEFEEDU_31HGhqzOCE8,81 +typing_extensions.py,sha256=yc4JTd6bjOByfhkxAnQJjjkZ5LDeI_Id3D3KgdqWSbg,70613 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/typing_extensions-4.2.0.dist-info/REQUESTED b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/typing_extensions-4.2.0.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/typing_extensions-4.2.0.dist-info/WHEEL b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/typing_extensions-4.2.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..668ba4d0151c5c76ed6e758061daa8c1b0bf5d21 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/typing_extensions-4.2.0.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: flit 3.7.1 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/urllib3-1.26.9.dist-info/LICENSE.txt b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/urllib3-1.26.9.dist-info/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..429a1767e4476707d2e45ee499e3c834ca4b187f --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/urllib3-1.26.9.dist-info/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2008-2020 Andrey Petrov and contributors (see CONTRIBUTORS.txt) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/urllib3-1.26.9.dist-info/METADATA b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/urllib3-1.26.9.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..885ce4476ad41bc680985511dc9480df83548932 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/urllib3-1.26.9.dist-info/METADATA @@ -0,0 +1,1426 @@ +Metadata-Version: 2.1 +Name: urllib3 +Version: 1.26.9 +Summary: HTTP library with thread-safe connection pooling, file post, and more. +Home-page: https://urllib3.readthedocs.io/ +Author: Andrey Petrov +Author-email: andrey.petrov@shazow.net +License: MIT +Project-URL: Documentation, https://urllib3.readthedocs.io/ +Project-URL: Code, https://github.com/urllib3/urllib3 +Project-URL: Issue tracker, https://github.com/urllib3/urllib3/issues +Keywords: urllib httplib threadsafe filepost http https ssl pooling +Platform: UNKNOWN +Classifier: Environment :: Web Environment +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Internet :: WWW/HTTP +Classifier: Topic :: Software Development :: Libraries +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4 +Description-Content-Type: text/x-rst +License-File: LICENSE.txt +Provides-Extra: brotli +Requires-Dist: brotlicffi (>=0.8.0) ; ((os_name != "nt" or python_version >= "3") and platform_python_implementation != "CPython") and extra == 'brotli' +Requires-Dist: brotli (>=1.0.9) ; ((os_name != "nt" or python_version >= "3") and platform_python_implementation == "CPython") and extra == 'brotli' +Requires-Dist: brotlipy (>=0.6.0) ; (os_name == "nt" and python_version < "3") and extra == 'brotli' +Provides-Extra: secure +Requires-Dist: pyOpenSSL (>=0.14) ; extra == 'secure' +Requires-Dist: cryptography (>=1.3.4) ; extra == 'secure' +Requires-Dist: idna (>=2.0.0) ; extra == 'secure' +Requires-Dist: certifi ; extra == 'secure' +Requires-Dist: ipaddress ; (python_version == "2.7") and extra == 'secure' +Provides-Extra: socks +Requires-Dist: PySocks (!=1.5.7,<2.0,>=1.5.6) ; extra == 'socks' + + +urllib3 is a powerful, *user-friendly* HTTP client for Python. Much of the +Python ecosystem already uses urllib3 and you should too. +urllib3 brings many critical features that are missing from the Python +standard libraries: + +- Thread safety. +- Connection pooling. +- Client-side SSL/TLS verification. +- File uploads with multipart encoding. +- Helpers for retrying requests and dealing with HTTP redirects. +- Support for gzip, deflate, and brotli encoding. +- Proxy support for HTTP and SOCKS. +- 100% test coverage. + +urllib3 is powerful and easy to use: + +.. code-block:: python + + >>> import urllib3 + >>> http = urllib3.PoolManager() + >>> r = http.request('GET', 'http://httpbin.org/robots.txt') + >>> r.status + 200 + >>> r.data + 'User-agent: *\nDisallow: /deny\n' + + +Installing +---------- + +urllib3 can be installed with `pip `_:: + + $ python -m pip install urllib3 + +Alternatively, you can grab the latest source code from `GitHub `_:: + + $ git clone git://github.com/urllib3/urllib3.git + $ pip install . + + +Documentation +------------- + +urllib3 has usage and reference documentation at `urllib3.readthedocs.io `_. + + +Contributing +------------ + +urllib3 happily accepts contributions. Please see our +`contributing documentation `_ +for some tips on getting started. + + +Security Disclosures +-------------------- + +To report a security vulnerability, please use the +`Tidelift security contact `_. +Tidelift will coordinate the fix and disclosure with maintainers. + + +Maintainers +----------- + +- `@sethmlarson `__ (Seth M. Larson) +- `@pquentin `__ (Quentin Pradet) +- `@theacodes `__ (Thea Flowers) +- `@haikuginger `__ (Jess Shapiro) +- `@lukasa `__ (Cory Benfield) +- `@sigmavirus24 `__ (Ian Stapleton Cordasco) +- `@shazow `__ (Andrey Petrov) + +👋 + + +Sponsorship +----------- + +If your company benefits from this library, please consider `sponsoring its +development `_. + + +For Enterprise +-------------- + +.. |tideliftlogo| image:: https://nedbatchelder.com/pix/Tidelift_Logos_RGB_Tidelift_Shorthand_On-White_small.png + :width: 75 + :alt: Tidelift + +.. list-table:: + :widths: 10 100 + + * - |tideliftlogo| + - Professional support for urllib3 is available as part of the `Tidelift + Subscription`_. Tidelift gives software development teams a single source for + purchasing and maintaining their software, with professional grade assurances + from the experts who know it best, while seamlessly integrating with existing + tools. + +.. _Tidelift Subscription: https://tidelift.com/subscription/pkg/pypi-urllib3?utm_source=pypi-urllib3&utm_medium=referral&utm_campaign=readme + + +Changes +======= + +1.26.9 (2022-03-16) +------------------- + +* Changed ``urllib3[brotli]`` extra to favor installing Brotli libraries that are still + receiving updates like ``brotli`` and ``brotlicffi`` instead of ``brotlipy``. + This change does not impact behavior of urllib3, only which dependencies are installed. +* Fixed a socket leaking when ``HTTPSConnection.connect()`` raises an exception. +* Fixed ``server_hostname`` being forwarded from ``PoolManager`` to ``HTTPConnectionPool`` + when requesting an HTTP URL. Should only be forwarded when requesting an HTTPS URL. + + +1.26.8 (2022-01-07) +------------------- + +* Added extra message to ``urllib3.exceptions.ProxyError`` when urllib3 detects that + a proxy is configured to use HTTPS but the proxy itself appears to only use HTTP. +* Added a mention of the size of the connection pool when discarding a connection due to the pool being full. +* Added explicit support for Python 3.11. +* Deprecated the ``Retry.MAX_BACKOFF`` class property in favor of ``Retry.DEFAULT_MAX_BACKOFF`` + to better match the rest of the default parameter names. ``Retry.MAX_BACKOFF`` is removed in v2.0. +* Changed location of the vendored ``ssl.match_hostname`` function from ``urllib3.packages.ssl_match_hostname`` + to ``urllib3.util.ssl_match_hostname`` to ensure Python 3.10+ compatibility after being repackaged + by downstream distributors. +* Fixed absolute imports, all imports are now relative. + + +1.26.7 (2021-09-22) +------------------- + +* Fixed a bug with HTTPS hostname verification involving IP addresses and lack + of SNI. (Issue #2400) +* Fixed a bug where IPv6 braces weren't stripped during certificate hostname + matching. (Issue #2240) + + +1.26.6 (2021-06-25) +------------------- + +* Deprecated the ``urllib3.contrib.ntlmpool`` module. urllib3 is not able to support + it properly due to `reasons listed in this issue `_. + If you are a user of this module please leave a comment. +* Changed ``HTTPConnection.request_chunked()`` to not erroneously emit multiple + ``Transfer-Encoding`` headers in the case that one is already specified. +* Fixed typo in deprecation message to recommend ``Retry.DEFAULT_ALLOWED_METHODS``. + + +1.26.5 (2021-05-26) +------------------- + +* Fixed deprecation warnings emitted in Python 3.10. +* Updated vendored ``six`` library to 1.16.0. +* Improved performance of URL parser when splitting + the authority component. + + +1.26.4 (2021-03-15) +------------------- + +* Changed behavior of the default ``SSLContext`` when connecting to HTTPS proxy + during HTTPS requests. The default ``SSLContext`` now sets ``check_hostname=True``. + + +1.26.3 (2021-01-26) +------------------- + +* Fixed bytes and string comparison issue with headers (Pull #2141) + +* Changed ``ProxySchemeUnknown`` error message to be + more actionable if the user supplies a proxy URL without + a scheme. (Pull #2107) + + +1.26.2 (2020-11-12) +------------------- + +* Fixed an issue where ``wrap_socket`` and ``CERT_REQUIRED`` wouldn't + be imported properly on Python 2.7.8 and earlier (Pull #2052) + + +1.26.1 (2020-11-11) +------------------- + +* Fixed an issue where two ``User-Agent`` headers would be sent if a + ``User-Agent`` header key is passed as ``bytes`` (Pull #2047) + + +1.26.0 (2020-11-10) +------------------- + +* **NOTE: urllib3 v2.0 will drop support for Python 2**. + `Read more in the v2.0 Roadmap `_. + +* Added support for HTTPS proxies contacting HTTPS servers (Pull #1923, Pull #1806) + +* Deprecated negotiating TLSv1 and TLSv1.1 by default. Users that + still wish to use TLS earlier than 1.2 without a deprecation warning + should opt-in explicitly by setting ``ssl_version=ssl.PROTOCOL_TLSv1_1`` (Pull #2002) + **Starting in urllib3 v2.0: Connections that receive a ``DeprecationWarning`` will fail** + +* Deprecated ``Retry`` options ``Retry.DEFAULT_METHOD_WHITELIST``, ``Retry.DEFAULT_REDIRECT_HEADERS_BLACKLIST`` + and ``Retry(method_whitelist=...)`` in favor of ``Retry.DEFAULT_ALLOWED_METHODS``, + ``Retry.DEFAULT_REMOVE_HEADERS_ON_REDIRECT``, and ``Retry(allowed_methods=...)`` + (Pull #2000) **Starting in urllib3 v2.0: Deprecated options will be removed** + +* Added default ``User-Agent`` header to every request (Pull #1750) + +* Added ``urllib3.util.SKIP_HEADER`` for skipping ``User-Agent``, ``Accept-Encoding``, + and ``Host`` headers from being automatically emitted with requests (Pull #2018) + +* Collapse ``transfer-encoding: chunked`` request data and framing into + the same ``socket.send()`` call (Pull #1906) + +* Send ``http/1.1`` ALPN identifier with every TLS handshake by default (Pull #1894) + +* Properly terminate SecureTransport connections when CA verification fails (Pull #1977) + +* Don't emit an ``SNIMissingWarning`` when passing ``server_hostname=None`` + to SecureTransport (Pull #1903) + +* Disabled requesting TLSv1.2 session tickets as they weren't being used by urllib3 (Pull #1970) + +* Suppress ``BrokenPipeError`` when writing request body after the server + has closed the socket (Pull #1524) + +* Wrap ``ssl.SSLError`` that can be raised from reading a socket (e.g. "bad MAC") + into an ``urllib3.exceptions.SSLError`` (Pull #1939) + + +1.25.11 (2020-10-19) +-------------------- + +* Fix retry backoff time parsed from ``Retry-After`` header when given + in the HTTP date format. The HTTP date was parsed as the local timezone + rather than accounting for the timezone in the HTTP date (typically + UTC) (Pull #1932, Pull #1935, Pull #1938, Pull #1949) + +* Fix issue where an error would be raised when the ``SSLKEYLOGFILE`` + environment variable was set to the empty string. Now ``SSLContext.keylog_file`` + is not set in this situation (Pull #2016) + + +1.25.10 (2020-07-22) +-------------------- + +* Added support for ``SSLKEYLOGFILE`` environment variable for + logging TLS session keys with use with programs like + Wireshark for decrypting captured web traffic (Pull #1867) + +* Fixed loading of SecureTransport libraries on macOS Big Sur + due to the new dynamic linker cache (Pull #1905) + +* Collapse chunked request bodies data and framing into one + call to ``send()`` to reduce the number of TCP packets by 2-4x (Pull #1906) + +* Don't insert ``None`` into ``ConnectionPool`` if the pool + was empty when requesting a connection (Pull #1866) + +* Avoid ``hasattr`` call in ``BrotliDecoder.decompress()`` (Pull #1858) + + +1.25.9 (2020-04-16) +------------------- + +* Added ``InvalidProxyConfigurationWarning`` which is raised when + erroneously specifying an HTTPS proxy URL. urllib3 doesn't currently + support connecting to HTTPS proxies but will soon be able to + and we would like users to migrate properly without much breakage. + + See `this GitHub issue `_ + for more information on how to fix your proxy config. (Pull #1851) + +* Drain connection after ``PoolManager`` redirect (Pull #1817) + +* Ensure ``load_verify_locations`` raises ``SSLError`` for all backends (Pull #1812) + +* Rename ``VerifiedHTTPSConnection`` to ``HTTPSConnection`` (Pull #1805) + +* Allow the CA certificate data to be passed as a string (Pull #1804) + +* Raise ``ValueError`` if method contains control characters (Pull #1800) + +* Add ``__repr__`` to ``Timeout`` (Pull #1795) + + +1.25.8 (2020-01-20) +------------------- + +* Drop support for EOL Python 3.4 (Pull #1774) + +* Optimize _encode_invalid_chars (Pull #1787) + + +1.25.7 (2019-11-11) +------------------- + +* Preserve ``chunked`` parameter on retries (Pull #1715, Pull #1734) + +* Allow unset ``SERVER_SOFTWARE`` in App Engine (Pull #1704, Issue #1470) + +* Fix issue where URL fragment was sent within the request target. (Pull #1732) + +* Fix issue where an empty query section in a URL would fail to parse. (Pull #1732) + +* Remove TLS 1.3 support in SecureTransport due to Apple removing support (Pull #1703) + + +1.25.6 (2019-09-24) +------------------- + +* Fix issue where tilde (``~``) characters were incorrectly + percent-encoded in the path. (Pull #1692) + + +1.25.5 (2019-09-19) +------------------- + +* Add mitigation for BPO-37428 affecting Python <3.7.4 and OpenSSL 1.1.1+ which + caused certificate verification to be enabled when using ``cert_reqs=CERT_NONE``. + (Issue #1682) + + +1.25.4 (2019-09-19) +------------------- + +* Propagate Retry-After header settings to subsequent retries. (Pull #1607) + +* Fix edge case where Retry-After header was still respected even when + explicitly opted out of. (Pull #1607) + +* Remove dependency on ``rfc3986`` for URL parsing. + +* Fix issue where URLs containing invalid characters within ``Url.auth`` would + raise an exception instead of percent-encoding those characters. + +* Add support for ``HTTPResponse.auto_close = False`` which makes HTTP responses + work well with BufferedReaders and other ``io`` module features. (Pull #1652) + +* Percent-encode invalid characters in URL for ``HTTPConnectionPool.request()`` (Pull #1673) + + +1.25.3 (2019-05-23) +------------------- + +* Change ``HTTPSConnection`` to load system CA certificates + when ``ca_certs``, ``ca_cert_dir``, and ``ssl_context`` are + unspecified. (Pull #1608, Issue #1603) + +* Upgrade bundled rfc3986 to v1.3.2. (Pull #1609, Issue #1605) + + +1.25.2 (2019-04-28) +------------------- + +* Change ``is_ipaddress`` to not detect IPvFuture addresses. (Pull #1583) + +* Change ``parse_url`` to percent-encode invalid characters within the + path, query, and target components. (Pull #1586) + + +1.25.1 (2019-04-24) +------------------- + +* Add support for Google's ``Brotli`` package. (Pull #1572, Pull #1579) + +* Upgrade bundled rfc3986 to v1.3.1 (Pull #1578) + + +1.25 (2019-04-22) +----------------- + +* Require and validate certificates by default when using HTTPS (Pull #1507) + +* Upgraded ``urllib3.utils.parse_url()`` to be RFC 3986 compliant. (Pull #1487) + +* Added support for ``key_password`` for ``HTTPSConnectionPool`` to use + encrypted ``key_file`` without creating your own ``SSLContext`` object. (Pull #1489) + +* Add TLSv1.3 support to CPython, pyOpenSSL, and SecureTransport ``SSLContext`` + implementations. (Pull #1496) + +* Switched the default multipart header encoder from RFC 2231 to HTML 5 working draft. (Issue #303, Pull #1492) + +* Fixed issue where OpenSSL would block if an encrypted client private key was + given and no password was given. Instead an ``SSLError`` is raised. (Pull #1489) + +* Added support for Brotli content encoding. It is enabled automatically if + ``brotlipy`` package is installed which can be requested with + ``urllib3[brotli]`` extra. (Pull #1532) + +* Drop ciphers using DSS key exchange from default TLS cipher suites. + Improve default ciphers when using SecureTransport. (Pull #1496) + +* Implemented a more efficient ``HTTPResponse.__iter__()`` method. (Issue #1483) + +1.24.3 (2019-05-01) +------------------- + +* Apply fix for CVE-2019-9740. (Pull #1591) + +1.24.2 (2019-04-17) +------------------- + +* Don't load system certificates by default when any other ``ca_certs``, ``ca_certs_dir`` or + ``ssl_context`` parameters are specified. + +* Remove Authorization header regardless of case when redirecting to cross-site. (Issue #1510) + +* Add support for IPv6 addresses in subjectAltName section of certificates. (Issue #1269) + + +1.24.1 (2018-11-02) +------------------- + +* Remove quadratic behavior within ``GzipDecoder.decompress()`` (Issue #1467) + +* Restored functionality of ``ciphers`` parameter for ``create_urllib3_context()``. (Issue #1462) + + +1.24 (2018-10-16) +----------------- + +* Allow key_server_hostname to be specified when initializing a PoolManager to allow custom SNI to be overridden. (Pull #1449) + +* Test against Python 3.7 on AppVeyor. (Pull #1453) + +* Early-out ipv6 checks when running on App Engine. (Pull #1450) + +* Change ambiguous description of backoff_factor (Pull #1436) + +* Add ability to handle multiple Content-Encodings (Issue #1441 and Pull #1442) + +* Skip DNS names that can't be idna-decoded when using pyOpenSSL (Issue #1405). + +* Add a server_hostname parameter to HTTPSConnection which allows for + overriding the SNI hostname sent in the handshake. (Pull #1397) + +* Drop support for EOL Python 2.6 (Pull #1429 and Pull #1430) + +* Fixed bug where responses with header Content-Type: message/* erroneously + raised HeaderParsingError, resulting in a warning being logged. (Pull #1439) + +* Move urllib3 to src/urllib3 (Pull #1409) + + +1.23 (2018-06-04) +----------------- + +* Allow providing a list of headers to strip from requests when redirecting + to a different host. Defaults to the ``Authorization`` header. Different + headers can be set via ``Retry.remove_headers_on_redirect``. (Issue #1316) + +* Fix ``util.selectors._fileobj_to_fd`` to accept ``long`` (Issue #1247). + +* Dropped Python 3.3 support. (Pull #1242) + +* Put the connection back in the pool when calling stream() or read_chunked() on + a chunked HEAD response. (Issue #1234) + +* Fixed pyOpenSSL-specific ssl client authentication issue when clients + attempted to auth via certificate + chain (Issue #1060) + +* Add the port to the connectionpool connect print (Pull #1251) + +* Don't use the ``uuid`` module to create multipart data boundaries. (Pull #1380) + +* ``read_chunked()`` on a closed response returns no chunks. (Issue #1088) + +* Add Python 2.6 support to ``contrib.securetransport`` (Pull #1359) + +* Added support for auth info in url for SOCKS proxy (Pull #1363) + + +1.22 (2017-07-20) +----------------- + +* Fixed missing brackets in ``HTTP CONNECT`` when connecting to IPv6 address via + IPv6 proxy. (Issue #1222) + +* Made the connection pool retry on ``SSLError``. The original ``SSLError`` + is available on ``MaxRetryError.reason``. (Issue #1112) + +* Drain and release connection before recursing on retry/redirect. Fixes + deadlocks with a blocking connectionpool. (Issue #1167) + +* Fixed compatibility for cookiejar. (Issue #1229) + +* pyopenssl: Use vendored version of ``six``. (Issue #1231) + + +1.21.1 (2017-05-02) +------------------- + +* Fixed SecureTransport issue that would cause long delays in response body + delivery. (Pull #1154) + +* Fixed regression in 1.21 that threw exceptions when users passed the + ``socket_options`` flag to the ``PoolManager``. (Issue #1165) + +* Fixed regression in 1.21 that threw exceptions when users passed the + ``assert_hostname`` or ``assert_fingerprint`` flag to the ``PoolManager``. + (Pull #1157) + + +1.21 (2017-04-25) +----------------- + +* Improved performance of certain selector system calls on Python 3.5 and + later. (Pull #1095) + +* Resolved issue where the PyOpenSSL backend would not wrap SysCallError + exceptions appropriately when sending data. (Pull #1125) + +* Selectors now detects a monkey-patched select module after import for modules + that patch the select module like eventlet, greenlet. (Pull #1128) + +* Reduced memory consumption when streaming zlib-compressed responses + (as opposed to raw deflate streams). (Pull #1129) + +* Connection pools now use the entire request context when constructing the + pool key. (Pull #1016) + +* ``PoolManager.connection_from_*`` methods now accept a new keyword argument, + ``pool_kwargs``, which are merged with the existing ``connection_pool_kw``. + (Pull #1016) + +* Add retry counter for ``status_forcelist``. (Issue #1147) + +* Added ``contrib`` module for using SecureTransport on macOS: + ``urllib3.contrib.securetransport``. (Pull #1122) + +* urllib3 now only normalizes the case of ``http://`` and ``https://`` schemes: + for schemes it does not recognise, it assumes they are case-sensitive and + leaves them unchanged. + (Issue #1080) + + +1.20 (2017-01-19) +----------------- + +* Added support for waiting for I/O using selectors other than select, + improving urllib3's behaviour with large numbers of concurrent connections. + (Pull #1001) + +* Updated the date for the system clock check. (Issue #1005) + +* ConnectionPools now correctly consider hostnames to be case-insensitive. + (Issue #1032) + +* Outdated versions of PyOpenSSL now cause the PyOpenSSL contrib module + to fail when it is injected, rather than at first use. (Pull #1063) + +* Outdated versions of cryptography now cause the PyOpenSSL contrib module + to fail when it is injected, rather than at first use. (Issue #1044) + +* Automatically attempt to rewind a file-like body object when a request is + retried or redirected. (Pull #1039) + +* Fix some bugs that occur when modules incautiously patch the queue module. + (Pull #1061) + +* Prevent retries from occurring on read timeouts for which the request method + was not in the method whitelist. (Issue #1059) + +* Changed the PyOpenSSL contrib module to lazily load idna to avoid + unnecessarily bloating the memory of programs that don't need it. (Pull + #1076) + +* Add support for IPv6 literals with zone identifiers. (Pull #1013) + +* Added support for socks5h:// and socks4a:// schemes when working with SOCKS + proxies, and controlled remote DNS appropriately. (Issue #1035) + + +1.19.1 (2016-11-16) +------------------- + +* Fixed AppEngine import that didn't function on Python 3.5. (Pull #1025) + + +1.19 (2016-11-03) +----------------- + +* urllib3 now respects Retry-After headers on 413, 429, and 503 responses when + using the default retry logic. (Pull #955) + +* Remove markers from setup.py to assist ancient setuptools versions. (Issue + #986) + +* Disallow superscripts and other integerish things in URL ports. (Issue #989) + +* Allow urllib3's HTTPResponse.stream() method to continue to work with + non-httplib underlying FPs. (Pull #990) + +* Empty filenames in multipart headers are now emitted as such, rather than + being suppressed. (Issue #1015) + +* Prefer user-supplied Host headers on chunked uploads. (Issue #1009) + + +1.18.1 (2016-10-27) +------------------- + +* CVE-2016-9015. Users who are using urllib3 version 1.17 or 1.18 along with + PyOpenSSL injection and OpenSSL 1.1.0 *must* upgrade to this version. This + release fixes a vulnerability whereby urllib3 in the above configuration + would silently fail to validate TLS certificates due to erroneously setting + invalid flags in OpenSSL's ``SSL_CTX_set_verify`` function. These erroneous + flags do not cause a problem in OpenSSL versions before 1.1.0, which + interprets the presence of any flag as requesting certificate validation. + + There is no PR for this patch, as it was prepared for simultaneous disclosure + and release. The master branch received the same fix in Pull #1010. + + +1.18 (2016-09-26) +----------------- + +* Fixed incorrect message for IncompleteRead exception. (Pull #973) + +* Accept ``iPAddress`` subject alternative name fields in TLS certificates. + (Issue #258) + +* Fixed consistency of ``HTTPResponse.closed`` between Python 2 and 3. + (Issue #977) + +* Fixed handling of wildcard certificates when using PyOpenSSL. (Issue #979) + + +1.17 (2016-09-06) +----------------- + +* Accept ``SSLContext`` objects for use in SSL/TLS negotiation. (Issue #835) + +* ConnectionPool debug log now includes scheme, host, and port. (Issue #897) + +* Substantially refactored documentation. (Issue #887) + +* Used URLFetch default timeout on AppEngine, rather than hardcoding our own. + (Issue #858) + +* Normalize the scheme and host in the URL parser (Issue #833) + +* ``HTTPResponse`` contains the last ``Retry`` object, which now also + contains retries history. (Issue #848) + +* Timeout can no longer be set as boolean, and must be greater than zero. + (Pull #924) + +* Removed pyasn1 and ndg-httpsclient from dependencies used for PyOpenSSL. We + now use cryptography and idna, both of which are already dependencies of + PyOpenSSL. (Pull #930) + +* Fixed infinite loop in ``stream`` when amt=None. (Issue #928) + +* Try to use the operating system's certificates when we are using an + ``SSLContext``. (Pull #941) + +* Updated cipher suite list to allow ChaCha20+Poly1305. AES-GCM is preferred to + ChaCha20, but ChaCha20 is then preferred to everything else. (Pull #947) + +* Updated cipher suite list to remove 3DES-based cipher suites. (Pull #958) + +* Removed the cipher suite fallback to allow HIGH ciphers. (Pull #958) + +* Implemented ``length_remaining`` to determine remaining content + to be read. (Pull #949) + +* Implemented ``enforce_content_length`` to enable exceptions when + incomplete data chunks are received. (Pull #949) + +* Dropped connection start, dropped connection reset, redirect, forced retry, + and new HTTPS connection log levels to DEBUG, from INFO. (Pull #967) + + +1.16 (2016-06-11) +----------------- + +* Disable IPv6 DNS when IPv6 connections are not possible. (Issue #840) + +* Provide ``key_fn_by_scheme`` pool keying mechanism that can be + overridden. (Issue #830) + +* Normalize scheme and host to lowercase for pool keys, and include + ``source_address``. (Issue #830) + +* Cleaner exception chain in Python 3 for ``_make_request``. + (Issue #861) + +* Fixed installing ``urllib3[socks]`` extra. (Issue #864) + +* Fixed signature of ``ConnectionPool.close`` so it can actually safely be + called by subclasses. (Issue #873) + +* Retain ``release_conn`` state across retries. (Issues #651, #866) + +* Add customizable ``HTTPConnectionPool.ResponseCls``, which defaults to + ``HTTPResponse`` but can be replaced with a subclass. (Issue #879) + + +1.15.1 (2016-04-11) +------------------- + +* Fix packaging to include backports module. (Issue #841) + + +1.15 (2016-04-06) +----------------- + +* Added Retry(raise_on_status=False). (Issue #720) + +* Always use setuptools, no more distutils fallback. (Issue #785) + +* Dropped support for Python 3.2. (Issue #786) + +* Chunked transfer encoding when requesting with ``chunked=True``. + (Issue #790) + +* Fixed regression with IPv6 port parsing. (Issue #801) + +* Append SNIMissingWarning messages to allow users to specify it in + the PYTHONWARNINGS environment variable. (Issue #816) + +* Handle unicode headers in Py2. (Issue #818) + +* Log certificate when there is a hostname mismatch. (Issue #820) + +* Preserve order of request/response headers. (Issue #821) + + +1.14 (2015-12-29) +----------------- + +* contrib: SOCKS proxy support! (Issue #762) + +* Fixed AppEngine handling of transfer-encoding header and bug + in Timeout defaults checking. (Issue #763) + + +1.13.1 (2015-12-18) +------------------- + +* Fixed regression in IPv6 + SSL for match_hostname. (Issue #761) + + +1.13 (2015-12-14) +----------------- + +* Fixed ``pip install urllib3[secure]`` on modern pip. (Issue #706) + +* pyopenssl: Fixed SSL3_WRITE_PENDING error. (Issue #717) + +* pyopenssl: Support for TLSv1.1 and TLSv1.2. (Issue #696) + +* Close connections more defensively on exception. (Issue #734) + +* Adjusted ``read_chunked`` to handle gzipped, chunk-encoded bodies without + repeatedly flushing the decoder, to function better on Jython. (Issue #743) + +* Accept ``ca_cert_dir`` for SSL-related PoolManager configuration. (Issue #758) + + +1.12 (2015-09-03) +----------------- + +* Rely on ``six`` for importing ``httplib`` to work around + conflicts with other Python 3 shims. (Issue #688) + +* Add support for directories of certificate authorities, as supported by + OpenSSL. (Issue #701) + +* New exception: ``NewConnectionError``, raised when we fail to establish + a new connection, usually ``ECONNREFUSED`` socket error. + + +1.11 (2015-07-21) +----------------- + +* When ``ca_certs`` is given, ``cert_reqs`` defaults to + ``'CERT_REQUIRED'``. (Issue #650) + +* ``pip install urllib3[secure]`` will install Certifi and + PyOpenSSL as dependencies. (Issue #678) + +* Made ``HTTPHeaderDict`` usable as a ``headers`` input value + (Issues #632, #679) + +* Added `urllib3.contrib.appengine `_ + which has an ``AppEngineManager`` for using ``URLFetch`` in a + Google AppEngine environment. (Issue #664) + +* Dev: Added test suite for AppEngine. (Issue #631) + +* Fix performance regression when using PyOpenSSL. (Issue #626) + +* Passing incorrect scheme (e.g. ``foo://``) will raise + ``ValueError`` instead of ``AssertionError`` (backwards + compatible for now, but please migrate). (Issue #640) + +* Fix pools not getting replenished when an error occurs during a + request using ``release_conn=False``. (Issue #644) + +* Fix pool-default headers not applying for url-encoded requests + like GET. (Issue #657) + +* log.warning in Python 3 when headers are skipped due to parsing + errors. (Issue #642) + +* Close and discard connections if an error occurs during read. + (Issue #660) + +* Fix host parsing for IPv6 proxies. (Issue #668) + +* Separate warning type SubjectAltNameWarning, now issued once + per host. (Issue #671) + +* Fix ``httplib.IncompleteRead`` not getting converted to + ``ProtocolError`` when using ``HTTPResponse.stream()`` + (Issue #674) + +1.10.4 (2015-05-03) +------------------- + +* Migrate tests to Tornado 4. (Issue #594) + +* Append default warning configuration rather than overwrite. + (Issue #603) + +* Fix streaming decoding regression. (Issue #595) + +* Fix chunked requests losing state across keep-alive connections. + (Issue #599) + +* Fix hanging when chunked HEAD response has no body. (Issue #605) + + +1.10.3 (2015-04-21) +------------------- + +* Emit ``InsecurePlatformWarning`` when SSLContext object is missing. + (Issue #558) + +* Fix regression of duplicate header keys being discarded. + (Issue #563) + +* ``Response.stream()`` returns a generator for chunked responses. + (Issue #560) + +* Set upper-bound timeout when waiting for a socket in PyOpenSSL. + (Issue #585) + +* Work on platforms without `ssl` module for plain HTTP requests. + (Issue #587) + +* Stop relying on the stdlib's default cipher list. (Issue #588) + + +1.10.2 (2015-02-25) +------------------- + +* Fix file descriptor leakage on retries. (Issue #548) + +* Removed RC4 from default cipher list. (Issue #551) + +* Header performance improvements. (Issue #544) + +* Fix PoolManager not obeying redirect retry settings. (Issue #553) + + +1.10.1 (2015-02-10) +------------------- + +* Pools can be used as context managers. (Issue #545) + +* Don't re-use connections which experienced an SSLError. (Issue #529) + +* Don't fail when gzip decoding an empty stream. (Issue #535) + +* Add sha256 support for fingerprint verification. (Issue #540) + +* Fixed handling of header values containing commas. (Issue #533) + + +1.10 (2014-12-14) +----------------- + +* Disabled SSLv3. (Issue #473) + +* Add ``Url.url`` property to return the composed url string. (Issue #394) + +* Fixed PyOpenSSL + gevent ``WantWriteError``. (Issue #412) + +* ``MaxRetryError.reason`` will always be an exception, not string. + (Issue #481) + +* Fixed SSL-related timeouts not being detected as timeouts. (Issue #492) + +* Py3: Use ``ssl.create_default_context()`` when available. (Issue #473) + +* Emit ``InsecureRequestWarning`` for *every* insecure HTTPS request. + (Issue #496) + +* Emit ``SecurityWarning`` when certificate has no ``subjectAltName``. + (Issue #499) + +* Close and discard sockets which experienced SSL-related errors. + (Issue #501) + +* Handle ``body`` param in ``.request(...)``. (Issue #513) + +* Respect timeout with HTTPS proxy. (Issue #505) + +* PyOpenSSL: Handle ZeroReturnError exception. (Issue #520) + + +1.9.1 (2014-09-13) +------------------ + +* Apply socket arguments before binding. (Issue #427) + +* More careful checks if fp-like object is closed. (Issue #435) + +* Fixed packaging issues of some development-related files not + getting included. (Issue #440) + +* Allow performing *only* fingerprint verification. (Issue #444) + +* Emit ``SecurityWarning`` if system clock is waaay off. (Issue #445) + +* Fixed PyOpenSSL compatibility with PyPy. (Issue #450) + +* Fixed ``BrokenPipeError`` and ``ConnectionError`` handling in Py3. + (Issue #443) + + + +1.9 (2014-07-04) +---------------- + +* Shuffled around development-related files. If you're maintaining a distro + package of urllib3, you may need to tweak things. (Issue #415) + +* Unverified HTTPS requests will trigger a warning on the first request. See + our new `security documentation + `_ for details. + (Issue #426) + +* New retry logic and ``urllib3.util.retry.Retry`` configuration object. + (Issue #326) + +* All raised exceptions should now wrapped in a + ``urllib3.exceptions.HTTPException``-extending exception. (Issue #326) + +* All errors during a retry-enabled request should be wrapped in + ``urllib3.exceptions.MaxRetryError``, including timeout-related exceptions + which were previously exempt. Underlying error is accessible from the + ``.reason`` property. (Issue #326) + +* ``urllib3.exceptions.ConnectionError`` renamed to + ``urllib3.exceptions.ProtocolError``. (Issue #326) + +* Errors during response read (such as IncompleteRead) are now wrapped in + ``urllib3.exceptions.ProtocolError``. (Issue #418) + +* Requesting an empty host will raise ``urllib3.exceptions.LocationValueError``. + (Issue #417) + +* Catch read timeouts over SSL connections as + ``urllib3.exceptions.ReadTimeoutError``. (Issue #419) + +* Apply socket arguments before connecting. (Issue #427) + + +1.8.3 (2014-06-23) +------------------ + +* Fix TLS verification when using a proxy in Python 3.4.1. (Issue #385) + +* Add ``disable_cache`` option to ``urllib3.util.make_headers``. (Issue #393) + +* Wrap ``socket.timeout`` exception with + ``urllib3.exceptions.ReadTimeoutError``. (Issue #399) + +* Fixed proxy-related bug where connections were being reused incorrectly. + (Issues #366, #369) + +* Added ``socket_options`` keyword parameter which allows to define + ``setsockopt`` configuration of new sockets. (Issue #397) + +* Removed ``HTTPConnection.tcp_nodelay`` in favor of + ``HTTPConnection.default_socket_options``. (Issue #397) + +* Fixed ``TypeError`` bug in Python 2.6.4. (Issue #411) + + +1.8.2 (2014-04-17) +------------------ + +* Fix ``urllib3.util`` not being included in the package. + + +1.8.1 (2014-04-17) +------------------ + +* Fix AppEngine bug of HTTPS requests going out as HTTP. (Issue #356) + +* Don't install ``dummyserver`` into ``site-packages`` as it's only needed + for the test suite. (Issue #362) + +* Added support for specifying ``source_address``. (Issue #352) + + +1.8 (2014-03-04) +---------------- + +* Improved url parsing in ``urllib3.util.parse_url`` (properly parse '@' in + username, and blank ports like 'hostname:'). + +* New ``urllib3.connection`` module which contains all the HTTPConnection + objects. + +* Several ``urllib3.util.Timeout``-related fixes. Also changed constructor + signature to a more sensible order. [Backwards incompatible] + (Issues #252, #262, #263) + +* Use ``backports.ssl_match_hostname`` if it's installed. (Issue #274) + +* Added ``.tell()`` method to ``urllib3.response.HTTPResponse`` which + returns the number of bytes read so far. (Issue #277) + +* Support for platforms without threading. (Issue #289) + +* Expand default-port comparison in ``HTTPConnectionPool.is_same_host`` + to allow a pool with no specified port to be considered equal to to an + HTTP/HTTPS url with port 80/443 explicitly provided. (Issue #305) + +* Improved default SSL/TLS settings to avoid vulnerabilities. + (Issue #309) + +* Fixed ``urllib3.poolmanager.ProxyManager`` not retrying on connect errors. + (Issue #310) + +* Disable Nagle's Algorithm on the socket for non-proxies. A subset of requests + will send the entire HTTP request ~200 milliseconds faster; however, some of + the resulting TCP packets will be smaller. (Issue #254) + +* Increased maximum number of SubjectAltNames in ``urllib3.contrib.pyopenssl`` + from the default 64 to 1024 in a single certificate. (Issue #318) + +* Headers are now passed and stored as a custom + ``urllib3.collections_.HTTPHeaderDict`` object rather than a plain ``dict``. + (Issue #329, #333) + +* Headers no longer lose their case on Python 3. (Issue #236) + +* ``urllib3.contrib.pyopenssl`` now uses the operating system's default CA + certificates on inject. (Issue #332) + +* Requests with ``retries=False`` will immediately raise any exceptions without + wrapping them in ``MaxRetryError``. (Issue #348) + +* Fixed open socket leak with SSL-related failures. (Issue #344, #348) + + +1.7.1 (2013-09-25) +------------------ + +* Added granular timeout support with new ``urllib3.util.Timeout`` class. + (Issue #231) + +* Fixed Python 3.4 support. (Issue #238) + + +1.7 (2013-08-14) +---------------- + +* More exceptions are now pickle-able, with tests. (Issue #174) + +* Fixed redirecting with relative URLs in Location header. (Issue #178) + +* Support for relative urls in ``Location: ...`` header. (Issue #179) + +* ``urllib3.response.HTTPResponse`` now inherits from ``io.IOBase`` for bonus + file-like functionality. (Issue #187) + +* Passing ``assert_hostname=False`` when creating a HTTPSConnectionPool will + skip hostname verification for SSL connections. (Issue #194) + +* New method ``urllib3.response.HTTPResponse.stream(...)`` which acts as a + generator wrapped around ``.read(...)``. (Issue #198) + +* IPv6 url parsing enforces brackets around the hostname. (Issue #199) + +* Fixed thread race condition in + ``urllib3.poolmanager.PoolManager.connection_from_host(...)`` (Issue #204) + +* ``ProxyManager`` requests now include non-default port in ``Host: ...`` + header. (Issue #217) + +* Added HTTPS proxy support in ``ProxyManager``. (Issue #170 #139) + +* New ``RequestField`` object can be passed to the ``fields=...`` param which + can specify headers. (Issue #220) + +* Raise ``urllib3.exceptions.ProxyError`` when connecting to proxy fails. + (Issue #221) + +* Use international headers when posting file names. (Issue #119) + +* Improved IPv6 support. (Issue #203) + + +1.6 (2013-04-25) +---------------- + +* Contrib: Optional SNI support for Py2 using PyOpenSSL. (Issue #156) + +* ``ProxyManager`` automatically adds ``Host: ...`` header if not given. + +* Improved SSL-related code. ``cert_req`` now optionally takes a string like + "REQUIRED" or "NONE". Same with ``ssl_version`` takes strings like "SSLv23" + The string values reflect the suffix of the respective constant variable. + (Issue #130) + +* Vendored ``socksipy`` now based on Anorov's fork which handles unexpectedly + closed proxy connections and larger read buffers. (Issue #135) + +* Ensure the connection is closed if no data is received, fixes connection leak + on some platforms. (Issue #133) + +* Added SNI support for SSL/TLS connections on Py32+. (Issue #89) + +* Tests fixed to be compatible with Py26 again. (Issue #125) + +* Added ability to choose SSL version by passing an ``ssl.PROTOCOL_*`` constant + to the ``ssl_version`` parameter of ``HTTPSConnectionPool``. (Issue #109) + +* Allow an explicit content type to be specified when encoding file fields. + (Issue #126) + +* Exceptions are now pickleable, with tests. (Issue #101) + +* Fixed default headers not getting passed in some cases. (Issue #99) + +* Treat "content-encoding" header value as case-insensitive, per RFC 2616 + Section 3.5. (Issue #110) + +* "Connection Refused" SocketErrors will get retried rather than raised. + (Issue #92) + +* Updated vendored ``six``, no longer overrides the global ``six`` module + namespace. (Issue #113) + +* ``urllib3.exceptions.MaxRetryError`` contains a ``reason`` property holding + the exception that prompted the final retry. If ``reason is None`` then it + was due to a redirect. (Issue #92, #114) + +* Fixed ``PoolManager.urlopen()`` from not redirecting more than once. + (Issue #149) + +* Don't assume ``Content-Type: text/plain`` for multi-part encoding parameters + that are not files. (Issue #111) + +* Pass `strict` param down to ``httplib.HTTPConnection``. (Issue #122) + +* Added mechanism to verify SSL certificates by fingerprint (md5, sha1) or + against an arbitrary hostname (when connecting by IP or for misconfigured + servers). (Issue #140) + +* Streaming decompression support. (Issue #159) + + +1.5 (2012-08-02) +---------------- + +* Added ``urllib3.add_stderr_logger()`` for quickly enabling STDERR debug + logging in urllib3. + +* Native full URL parsing (including auth, path, query, fragment) available in + ``urllib3.util.parse_url(url)``. + +* Built-in redirect will switch method to 'GET' if status code is 303. + (Issue #11) + +* ``urllib3.PoolManager`` strips the scheme and host before sending the request + uri. (Issue #8) + +* New ``urllib3.exceptions.DecodeError`` exception for when automatic decoding, + based on the Content-Type header, fails. + +* Fixed bug with pool depletion and leaking connections (Issue #76). Added + explicit connection closing on pool eviction. Added + ``urllib3.PoolManager.clear()``. + +* 99% -> 100% unit test coverage. + + +1.4 (2012-06-16) +---------------- + +* Minor AppEngine-related fixes. + +* Switched from ``mimetools.choose_boundary`` to ``uuid.uuid4()``. + +* Improved url parsing. (Issue #73) + +* IPv6 url support. (Issue #72) + + +1.3 (2012-03-25) +---------------- + +* Removed pre-1.0 deprecated API. + +* Refactored helpers into a ``urllib3.util`` submodule. + +* Fixed multipart encoding to support list-of-tuples for keys with multiple + values. (Issue #48) + +* Fixed multiple Set-Cookie headers in response not getting merged properly in + Python 3. (Issue #53) + +* AppEngine support with Py27. (Issue #61) + +* Minor ``encode_multipart_formdata`` fixes related to Python 3 strings vs + bytes. + + +1.2.2 (2012-02-06) +------------------ + +* Fixed packaging bug of not shipping ``test-requirements.txt``. (Issue #47) + + +1.2.1 (2012-02-05) +------------------ + +* Fixed another bug related to when ``ssl`` module is not available. (Issue #41) + +* Location parsing errors now raise ``urllib3.exceptions.LocationParseError`` + which inherits from ``ValueError``. + + +1.2 (2012-01-29) +---------------- + +* Added Python 3 support (tested on 3.2.2) + +* Dropped Python 2.5 support (tested on 2.6.7, 2.7.2) + +* Use ``select.poll`` instead of ``select.select`` for platforms that support + it. + +* Use ``Queue.LifoQueue`` instead of ``Queue.Queue`` for more aggressive + connection reusing. Configurable by overriding ``ConnectionPool.QueueCls``. + +* Fixed ``ImportError`` during install when ``ssl`` module is not available. + (Issue #41) + +* Fixed ``PoolManager`` redirects between schemes (such as HTTP -> HTTPS) not + completing properly. (Issue #28, uncovered by Issue #10 in v1.1) + +* Ported ``dummyserver`` to use ``tornado`` instead of ``webob`` + + ``eventlet``. Removed extraneous unsupported dummyserver testing backends. + Added socket-level tests. + +* More tests. Achievement Unlocked: 99% Coverage. + + +1.1 (2012-01-07) +---------------- + +* Refactored ``dummyserver`` to its own root namespace module (used for + testing). + +* Added hostname verification for ``VerifiedHTTPSConnection`` by vendoring in + Py32's ``ssl_match_hostname``. (Issue #25) + +* Fixed cross-host HTTP redirects when using ``PoolManager``. (Issue #10) + +* Fixed ``decode_content`` being ignored when set through ``urlopen``. (Issue + #27) + +* Fixed timeout-related bugs. (Issues #17, #23) + + +1.0.2 (2011-11-04) +------------------ + +* Fixed typo in ``VerifiedHTTPSConnection`` which would only present as a bug if + you're using the object manually. (Thanks pyos) + +* Made RecentlyUsedContainer (and consequently PoolManager) more thread-safe by + wrapping the access log in a mutex. (Thanks @christer) + +* Made RecentlyUsedContainer more dict-like (corrected ``__delitem__`` and + ``__getitem__`` behaviour), with tests. Shouldn't affect core urllib3 code. + + +1.0.1 (2011-10-10) +------------------ + +* Fixed a bug where the same connection would get returned into the pool twice, + causing extraneous "HttpConnectionPool is full" log warnings. + + +1.0 (2011-10-08) +---------------- + +* Added ``PoolManager`` with LRU expiration of connections (tested and + documented). +* Added ``ProxyManager`` (needs tests, docs, and confirmation that it works + with HTTPS proxies). +* Added optional partial-read support for responses when + ``preload_content=False``. You can now make requests and just read the headers + without loading the content. +* Made response decoding optional (default on, same as before). +* Added optional explicit boundary string for ``encode_multipart_formdata``. +* Convenience request methods are now inherited from ``RequestMethods``. Old + helpers like ``get_url`` and ``post_url`` should be abandoned in favour of + the new ``request(method, url, ...)``. +* Refactored code to be even more decoupled, reusable, and extendable. +* License header added to ``.py`` files. +* Embiggened the documentation: Lots of Sphinx-friendly docstrings in the code + and docs in ``docs/`` and on https://urllib3.readthedocs.io/. +* Embettered all the things! +* Started writing this file. + + +0.4.1 (2011-07-17) +------------------ + +* Minor bug fixes, code cleanup. + + +0.4 (2011-03-01) +---------------- + +* Better unicode support. +* Added ``VerifiedHTTPSConnection``. +* Added ``NTLMConnectionPool`` in contrib. +* Minor improvements. + + +0.3.1 (2010-07-13) +------------------ + +* Added ``assert_host_name`` optional parameter. Now compatible with proxies. + + +0.3 (2009-12-10) +---------------- + +* Added HTTPS support. +* Minor bug fixes. +* Refactored, broken backwards compatibility with 0.2. +* API to be treated as stable from this version forward. + + +0.2 (2008-11-17) +---------------- + +* Added unit tests. +* Bug fixes. + + +0.1 (2008-11-16) +---------------- + +* First release. + + diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/urllib3-1.26.9.dist-info/top_level.txt b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/urllib3-1.26.9.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..a42590bebea6002a3c81cdbf89443ca1c3578d0b --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/urllib3-1.26.9.dist-info/top_level.txt @@ -0,0 +1 @@ +urllib3 diff --git a/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/wrapt/_wrappers.cpython-38-x86_64-linux-gnu.so b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/wrapt/_wrappers.cpython-38-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..2fba57f77a1f658345f709c2f47c38c8981bdb31 --- /dev/null +++ b/my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/wrapt/_wrappers.cpython-38-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:edeb86b6f660a10b6dd6b9db0eabc6608502351e301eb9c0604347650f7dc769 +size 203176